解决:nginx: [error] open() "/alidata/server/nginx/logs/nginx.pid" failed (2: No such file or directory

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fuckomg/article/details/68952753

使用的是阿里云的ecs服务器,重新nginx启动服务器时,发现报nginx: [error] open() “/alidata/server/nginx/logs/nginx.pid” failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件
  

[root@localhost sbin]# ./nginx -s reload
  nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

  解决方法:
 

 [root@localhost nginx]# /alidata/server/nginx/sbin/nginx -c /alidata/server/nginx/conf/nginx.conf

  使用nginx -c的参数指定nginx.conf文件的位置
 

 [root@localhost nginx]# cd logs/
  [root@localhost logs]# ll
总用量 12
  -rw-r--r-- 1 root root 1246 129 18:10 access.log
  -rw-r--r-- 1 root root 516 1210 15:39 error.log
  -rw-r--r-- 1 root root 5 1210 15:38 nginx.pid

  可以看到nginx.pid文件已经有了。

猜你喜欢

转载自blog.csdn.net/fuckomg/article/details/68952753