nginx -s reload "/alidata/server/nginx/logs/nginx.pid" failed

[root@snoopy 15:36:58 vhosts]# nginx -s reload
nginx: [error] open() "/alidata/server/nginx/logs/nginx.pid" failed (2: No such file or directory)

修改完nginx的配置后,想重启下nginx,结果提示这个错误,服务器是阿里云的ECS服务器

检查后发现 logs文件发现的确没有nginx.pid文件

解决方法(使用nginx -c的参数指定nginx.conf文件的位置 ):

[root@snoopy 15:37:39 nginx]# /alidata/server/nginx/sbin/nginx -c /alidata/server/nginx/conf/nginx.conf

去 logs 目录下查看,发现pid文件已经有了

[root@snoopy 15:51:05 nginx]# ll
total 36
drwx------  2 www  root 4096 Nov 12 15:13 client_body_temp
drw-r--r--  4 root root 4096 Oct 25 20:10 conf
drwx------ 12 www  root 4096 Aug 25  2016 fastcgi_temp
drwxr-xr-x  2 root root 4096 Jul  1  2015 html
drwxrwxr-x  2 www  www  4096 Nov 12 15:39 logs
drwx------ 12 www  root 4096 Jun  1 20:30 proxy_temp
drwxr-xr-x  2 root root 4096 Oct 23  2016 sbin
drwx------  2 www  root 4096 Jul  1  2015 scgi_temp
drwx------  2 www  root 4096 Jul  1  2015 uwsgi_temp
[root@snoopy 15:54:27 nginx]# cd logs
[root@snoopy 15:54:30 logs]# ll
total 4348
-rw-r--r-- 1 www  root 4026619 Nov 12 14:49 access.log
-rw-r--r-- 1 root root  408896 Nov 12 15:39 error.log
-rw-r--r-- 1 root root       6 Nov 12 15:39 nginx.pid
[root@zhipuzi 15:54:31 logs]# 
原文地址:https://www.cnblogs.com/lyc94620/p/9946969.html