启动
启动代码格式:nginx安装目录地址 -c nginx配置文件地址
[root@Jackson666]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
查看状态
查看进程号
ps -ef|grep nginx # 8041 8232
杀死进程
(Blog) root@Jackson666:/Project/Blog/dj31/deploy# kill -TERM 25120
强制停止
(Blog) root@Jackson666:/Project/Blog/dj31/deploy# pkill -9 nginx
重启
方法一:首先验证nginx配置文件(/etc/nginx/nginx.conf)是否正确如下图所示。
切换到:nginx安装目录地址,执行 ./nginx -t
(Blog) root@Jackson666:/usr/sbin# ./nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
看到如下显示nginx.conf syntax is ok
nginx.conf test is successful
说明配置文件正确!
方法二:在启动命令-c前加-t
(Blog) root@Jackson666:/usr/sbin# /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
如果显示的是OK那么配置一切正常,关于如何配置可以看看https://www.cnblogs.com/jackson669/p/12726762.html
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
方法三:重启服务
进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可
方法一: (Blog) root@Jackson666:/usr/sbin# ./nginx -s reload
方法二: (Blog) root@Jackson666:/usr/sbin# kill -HUP 25394