Reprint https://www.cnblogs.com/codingcloud/p/5095066.html
start up
Startup code format: nginx installation directory address -c nginx configuration file address
E.g:
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
stop
There are three ways to stop nginx:
stop calmly
1. View the process number
[root@LinuxServer ~]# ps -ef|grep nginx
2. Kill the process
[root@LinuxServer ~]# kill -QUIT 2072
quick stop
1. View the process number
[root@LinuxServer ~]# ps -ef|grep nginx
2. Kill the process
[root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132
forced stop
[root@LinuxServer ~]# pkill -9 nginx
reboot
1. Verify that the nginx configuration file is correct
Method 1: Enter the nginx installation directory sbin and enter the command ./nginx -t
看到如下显示nginx.conf syntax is ok
nginx.conf test is successful
说明配置文件正确!
方法二:在启动命令-c前加-t
2、重启Nginx服务
方法一:进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可
方法二:查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务
分类:
Nginx