#查看nginx進程
[root@LinuxServer]$ps -aux | grep nginx root 3229 0.0 0.0 112812 972 pts/0 S+ 16:50 0:00 grep --color=auto nginx root 15919 1.5 0.4 122856 68888 ? S Mar07 290:44 nginx: worker process root 15920 0.7 0.4 123320 68932 ? S Mar07 134:04 nginx: worker process root 15921 0.9 0.4 123320 68840 ? S Mar07 176:46 nginx: worker process root 15922 2.9 0.4 125924 71920 ? S Mar07 548:55 nginx: worker process root 20544 0.0 0.2 96184 37844 ? Ss 2021 0:01 nginx: master process nginx
#測試Nginx配置文件,可以看到nginx配置文件位置
[root@LinuxServer /]$nginx -t nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
#啟動
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf [root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
#停止
從容停止
[root@LinuxServer ~]# kill -QUIT 2072
#快速停止
[root@LinuxServer ~]# kill -TERM 2132 或 [root@LinuxServer ~]# kill -INT 2132
#強制停止
[root@LinuxServer ~]# pkill -9 nginx
#重啟
#進入nginx可執行目錄sbin下,輸入命令./nginx -s reload
[root@LinuxServer sbin]$pwd /usr/local/nginx/sbin [root@LinuxServer sbin]$ll total 9232 -rwxr-xr-x 1 root root 9451008 Dec 3 2018 nginx nginx -s reload
#方法2 查找當前nginx進程號,然后輸入命令:kill -HUP 進程號 實現重啟nginx服務
