1. 程式人生 > >nginx: [error] invalid PID number問題處理

nginx: [error] invalid PID number問題處理

成功 啟動 local error 強制停止 正常 nginx服務 tex process

再啟動nginx服務時,無法正常啟動,報錯誤信息如下
nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
技術分享圖片

解決方法:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

使用nginx -c的參數指定nginx.conf文件的位置
然後再重新啟動,解決問題,可以通過ps -ef|grep nginx 看到服務已經啟動成功
技術分享圖片

檢查nginx 是否配置成功方法
技術分享圖片

nginx其他命令
nginx 服務器重啟命令,關閉
nginx -s reload :修改配置後重新加載生效

nginx -s reopen :重新打開日誌文件

關閉nginx:
nginx -s stop :快速停止nginx
quit :完整有序的停止nginx

其他的停止nginx 方式:

ps -ef | grep nginx

kill -QUIT 主進程號 :從容停止Nginx

kill -TERM 主進程號 :快速停止Nginx
pkill -9 nginx :強制停止Nginx

平滑重啟nginx:
kill -HUP 主進程號

nginx: [error] invalid PID number問題處理