在編譯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