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

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

 ./nginx -s reloadspa

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

 

解決辦法:blog

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

  命令解釋:進程

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

 

設置成功以後在以前報錯的路徑下會生成 nginx.pid 文件io

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

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進程awk

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

  此時再-c  設置一下配置文件,以後再重啓nginx配置

相關文章
相關標籤/搜索