Nginx start, stop and other commands

Start, stop and other commands of Nginx under Windows

To use Nginx under Windows, we need to master some basic operation commands, such as: starting and stopping Nginx services, reloading Nginx, etc. I will give some brief introductions below.
1. Start:

C:\server\nginx-1.0.2>start nginx

or

C:\server\nginx-1.0.2>nginx.exe

Note: It is recommended to use the first one, and the second one will keep your cmd window in execution and cannot perform other command operations.

2. Stop:

C:\server\nginx-1.0.2>nginx.exe -s stop

or

C:\server\nginx-1.0.2>nginx.exe -s quit


Note: stop is to quickly stop nginx and may not save relevant information; quit is to stop nginx in a complete and orderly manner and save relevant information.

3. Reload Nginx:

C:\server\nginx-1.0.2>nginx.exe -s reload

Use this command when configuration information is modified and these configurations need to be reloaded.

4. Reopen the log file:

C:\server\nginx-1.0.2>nginx.exe -s reopen

5. Check the Nginx version:

C:\server\nginx-1.0.2>nginx -v

 

===========================================

linux

nginx -s reload : Reload takes effect after modifying the configuration
nginx -s reopen  :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确

关闭nginx:
nginx -s stop  :快速停止nginx
         quit  :完整有序的停止nginx

其他的停止nginx 方式:

ps -ef | grep nginx

kill -QUIT 主进程号     :从容停止Nginx
kill -TERM 主进程号     :快速停止Nginx
pkill -9 nginx          :强制停止Nginx



启动nginx:
nginx -c /path/to/nginx.conf

平滑重启nginx:
kill -HUP 主进程号

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326180205&siteId=291194637