nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
CentOS 7.5下啟動Nginx出現如下錯誤:
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
解決方法:找到你的nginx.conf的資料夾目錄,然後執行類似如下命令
nginx -c etc/nginx/nginx.conf
再執行nginx -s reload,就可以了。
如下圖:
案例2:
如果啟動Nginx出現如下錯誤:
[linuxidc@localhost www.linuxidc.com]$ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2018/11/03 10:26:00 [warn] 21354#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
2018/11/03 10:26:00 [notice] 21354#0: signal process started
2018/11/03 10:26:00 [alert] 21354#0: kill(21052, 1) failed (1: Operation not permitted)
原因:當前使用者對該位置沒有寫入許可權,輸入su和密碼進入root模式後,重新啟動伺服器就好了,原因是因為沒有許可權。
注:以非root許可權啟動時,會出現 nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) 錯誤。那就以root許可權啟動就好。
Linux公社的RSS地址 : ofollow,noindex" target="_blank">https://www.linuxidc.com/rssFeed.aspx
本文永久更新連結地址: https://www.linuxidc.com/Linux/2018-11/155150.htm