How to start nginx under linux
How to start nginx under linux? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
Detailed explanation of nginx startup command of linux
Start the operation
Nginx-c / usr/local/nginx/conf/nginx.conf
The-c parameter specifies the path of the nginx configuration file to load
Attached: nginx stop command under linux
Stop the operation
The stop operation is done by sending a signal to the nginx process
Step 1: query the nginx main process number
Ps-ef | grep nginx
Look for the master process in the process list, and its number is the main process number.
Step 2: send a signal
Stop Nginx calmly:
Kill-QUIT main process number
For example: kill-QUIT 16391
Quickly stop Nginx:
Kill-TERM main process number
Force stop Nginx:
Kill-9 main process number
In addition, if the pid file storage path is configured in nginx.conf, the file is stored in the Nginx main process number, if not specified, it is placed in the logs directory of nginx. With the pid document, instead of querying the main process number of Nginx, we send a signal directly to Nginx with the following command:
Kill-signal type'/ usr/local/nginx/logs/nginx.pid'
Smooth restart
If you change the configuration, you have to restart Nginx. Do you want to close Nginx and then turn it on? No, you can send a signal to Nginx and restart smoothly.
Smooth restart command:
Kill-HUP resides in the title or process number file path or uses / usr/nginx/sbin/nginx-s reload
Note that after modifying the configuration file, it is best to check whether the modified configuration file is correct, so as to avoid errors in Nginx that affect the stable operation of the server after restart. The command to determine whether the Nginx configuration is correct is as follows:
Nginx-t-c / usr/nginx/conf/nginx.conf or / usr/nginx/sbin/nginx-t Thank you for reading! After reading the above, do you have a general understanding of how to start nginx under linux? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.