新裝NGINX重啟,出現錯誤 nginx: [error] open() "/usr/local/nginx/logs/nginx.pid"


重裝nginx出現,重啟出現錯誤

 ./nginx -s reload

nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

 

解決辦法:

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

  命令解釋:

 -c filename : set configuration file (default: conf/nginx.conf)  設置配置文件

 

設置成功之后在之前報錯的路徑下會生成 nginx.pid 文件

  在設置的時候可能會出現如下錯誤:

nginx: [emerg] bind() to 0.0.0.0:9929 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

  這是因為我是重裝nginx的,之前nginx沒有停掉,可以使用命令殺死nginx進程

ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs kill -9

  此時再-c  設置一下配置文件,之后再重啟nginx

 

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM