Nginx
nginx is a high-performance HTTP and reverse proxy server. Asynchronous non-blocking I/O and capable of high concurrency.
- Forward proxy: The client is the proxy, and the server does not know who the client is.
- Reverse proxy: The server acts as a proxy and the client does not know who the server is.
Common commands
测试:nginx -t
启动:nginx
重启:nginx -s reload
停止:nginx -s stop
View system kernel information
[root@iZ8vba8362n915w3kubg90Z /]# cat /proc/version
Linux version 4.18.0-193.28.1.el8_2.x86_64 ([email protected]) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Thu Oct 22 00:20:22 UTC 2020
Installation configuration
- Add the nginx repo
and check whether there is an nginx.repo file in the /etc/yum.repos.d/ directory.
- If so, enter the current directory and enter:
vim nginx.repo
edit - If not, increase it
touch nginx.repo
and repeat the above steps.
Enter the following:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
-
:wq
After saving, useyum update
as follows:
-
Execute
yum install -y nginx
to install,nginx -v
check the version
-
Execute
nginx
the startup process, and then executeps -ef | grep nginx
to view the process startup status
-
The installed nginx
accesses the current server in the directory /etc/nginx, and the following interface will appear (stored in the /usr/share/nginx/html directory)
-
Enter /etc/nginx to execute
vim nginx.conf
and configure the project (under /home/dist). The configuration content is as follows:
server {
listen 8000;
server_name _;
root /home/dist;
location / {
}
error_page 404 /404.html;
location = /40x.html {}
}
:wq
After saving, nginx -s reload
restart nginx, and then access the server IP address and port. The project interface will appear, indicating that the configuration is successful.
If the access is unsuccessful, check whether the port access permission is enabled in the cloud server management background.
Summarize
The above is a detailed tutorial on Nginx online installation introduced by the editor to you. I hope it will be helpful to you!