Nginx (engine x) is a high-performance HTTP and reverse proxy service. It has many very superior features: In the case of high concurrency of connections, Nginx is a good substitute for Apache service: Nginx is one of the software platforms often chosen by bosses in the virtual host business in the United States.
Startup
Startup code format: nginx installation directory address -c nginx configuration file address
For example:
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
Stop
Stop nginx There are three ways:
Stop calmly
1. Check the process number
[root@LinuxServer ~]# ps -ef|grep nginx
2. Kill the process
[root@LinuxServer ~]# kill -QUIT 2072
Quick stop
1. Check the process number
[root@LinuxServer ~]# ps -ef|grep nginx
2. Kill the process
[root@LinuxServer ~]# kill -TERM 2132 或 [root@LinuxServer ~]# kill -INT 2132
Force stop
[root @LinuxServer ~]# pkill -9 nginx
Restart
1. Verify whether the nginx configuration file is correct
Method 1: Enter the nginx installation directory sbin and enter the command./ nginx -t
See the following display nginx.conf syntax is ok
nginx.conf test is successful
It means the configuration file is correct!
Method 2: Add -t before the startup command -c
2. Restart the Nginx service
Method 1: Enter nginx to Under the execution directory sbin, enter the command ./nginx -s reload to
Method 2: Find the current nginx process number, and then enter the command: kill -HUP process number to restart nginx service
The above is the detailed content of How to start nginx in Linux system. For more information, please follow other related articles on the PHP Chinese website!