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

 

  

 

posted @ 2019-02-13 10:07  StudyBlog  阅读(2012)  评论(0编辑  收藏  举报