Hey, the linux nginx command just can't remember.

Source: Internet
Author: User
Tags pkill

Start Nginx nginx-c/nginx path/nginx.conf

View Ps-ef | grep nginx

Kill Kill-quit Master Process number

Force stop pkill-9 Main process number

Stop operation stop is done by sending a signal to the nginx process (see the Linux article for a signal) Step 1: Query Nginx main process number Ps-ef | grep nginx in the process list to find the master process, its number is the main process number. Step 2: Send signal calmly stop nginx:kill-quit main process number Fast stop Nginx:kill-term main process number Force stop nginx:pkill-9 nginx  in addition, If the nginx.conf configuration of the PID file storage path, the file is stored in the Nginx main process number, if not specified in the Nginx logs directory. With the PID file, we do not have to query the Nginx main process number, and directly send a signal to Nginx, the command is as follows: Kill-signal type '/usr/nginx/logs/nginx.pid '   Smooth Restart if you change the configuration will restart Nginx, Do you want to turn the Nginx off before opening? No, can send a signal to nginx, smooth restart. Smooth restart command: Kill-hup live in the title or process number file path or use  /usr/nginx/sbin/nginx-s reload  Note that it is best to check the correct configuration file after modifying the configuration file. In order to avoid the restart after the Nginx error affecting the stable operation of the server. To determine if the Nginx configuration is correct, the command is as follows: Nginx-t-c/usr/nginx/conf/nginx.conf or  /usr/nginx/sbin/nginx-t  Smooth upgrade If the server is running Nginx to upgrade, add or remove modules, we need to stop the server and make corresponding changes, so that the server will stop the service for a period of time, Nginx can be in the case of non-stop operation of the various upgrade actions without affecting the server running. Step 1: If you upgrade the Nginx program, first replace the old program files with the new program, compile and install the new program directly compiled into the Nginx installation directory. Step 2: Execute the command KILL-USR2 the main process number or process file name of the legacy program this time the old Nginx master process will rename its process file to. oldbin, then execute the new version of Nginx. The old and new Nginx municipal run and process the request together. At this time to gradually stop the old version of Nginx, enter the command: Kill-winch old Moderator process number slowly old work process will be completed with the completion of the task to exit, the new version of Nginx work process will gradually replace the old version of the work process.   At this time, we canTo decide whether to use the new version or revert to the previous version. Do not reload the configuration to start new/old worker process kill-hup old/new master process number gracefully close older/newer process kill-quit old/new main process number if there is an error at this time, the prompt and the process is not finished with the following command to close the old/new worker process, and then close the main process number: Kill-term old/ New worker process number  

Hey, the linux nginx command just can't remember.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.