重啓nginx服務

nginx -s reload 直接重啓,沒有提示就是成功了。

# nginx -s reload
nginx: [error] invalid PID number "" in "/run/nginx.pid"

如果提示 invalid PID number

  • 先檢查一下配置是否有誤
# nginx -t
  • 沒有錯誤的話,指定nginx配置文件再重啓試試
# nginx -c /etc/nginx/nginx.conf
# nginx -s reload
  • 如果還是不行,就殺掉進程重啓
# ps -ef | grep nginx
root     22765     1  0 11:20 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx    22766 22765  0 11:20 ?        00:00:02 nginx: worker process
nginx    22767 22765  0 11:20 ?        00:00:02 nginx: worker process
root     23719 19310  0 11:27 pts/1    00:00:00 grep --color=auto nginx
# kill 22765
# kill 22766
# kill 22767
# service nginx start
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章