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

使用的是阿里云的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文件已经有了。


版权声明:本文为fuckomg原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。