PID file /usr/local/nginx/logs/nginx.pid not readable (yet?) after start.

在編譯nginx後,添加到systemctl中管理,啓動nginx(systemctl start nginx.service),使用systemctl  status nginx.service查看nginx狀態,雖然正常啓動了,但出現了PID file /usr/local/nginx/logs/nginx.pid not readable (yet?) after start.

經過查詢,這似乎是systemd和nginx之間的競賽。systemd希望在nginx有時間創建PID文件之前填充它,導致出現錯誤。

解決方法:
在/usr/lib/systemd/system/nginx.service中添加入下內容

ExecStartPost=/bin/sleep 0.1

執行命令:

systemctl daemon-reload

解決問題

參考:
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章