新装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配置

相关文章
相关标签/搜索