日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Nginx的启动、停止和重启

發布時間:2024/4/17 Nginx 80 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Nginx的启动、停止和重启 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

啟動

啟動代碼格式:nginx安裝目錄地址 -c nginx配置文件地址

例如:

[root@sijizhen sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

停止

nginx有三種停止方式:

從容停止

1.查看進程??ps -ef|grep nginx

[root@sijizhen sbin]# ps -ef|grep nginx root 9862 1 0 01:04 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nobody 9863 9862 0 01:04 ? 00:00:00 nginx: worker process root 9886 1612 0 01:15 pts/0 00:00:00 grep nginx

2.殺死進程??

[root@sijizhen sbin]# kill -QUIT 9862

快速停止

1、查看進程號

[root@sijizhen sbin]# ps -ef|grep nginx root 9892 1 0 01:17 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nobody 9893 9892 0 01:17 ? 00:00:00 nginx: worker process root 9895 1612 0 01:18 pts/0 00:00:00 grep nginx

2.殺死進程

[root@sijizhen sbin]# kill -TERM 9892

強制停止

[root@sijizhen sbin]# pkill -9 nginx

重啟

1、驗證nginx配置文件是否正確

方法一:進入nginx安裝目錄sbin下,輸入命令./nginx -t

[root@sijizhen sbin]# ./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

說明配置文件正確!

方法二:在啟動命令-c前加-t

[root@sijizhen sbin]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf 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

?2、重啟Nginx服務

?方法一:進入nginx可執行目錄sbin下,輸入命令./nginx -s reload?即可

[root@sijizhen sbin]# ./nginx -s reload

方法二:查找當前nginx進程號,然后輸入命令:kill -HUP 進程號 實現重啟nginx服務

[root@sijizhen sbin]# ps -ef|grep nginx root 9928 1 0 01:24 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf nobody 9935 9928 0 01:25 ? 00:00:00 nginx: worker process root 9938 1612 0 01:26 pts/0 00:00:00 grep nginx [root@sijizhen sbin]# kill -HUP 9928

參考:https://www.cnblogs.com/codingcloud/p/5095066.html

轉載于:https://www.cnblogs.com/sijizhen/p/10579696.html

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Nginx的启动、停止和重启的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。