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

Posted 凌雨尘

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx -s reload "/alidata/server/nginx/logs/nginx.pid" failed相关的知识,希望对你有一定的参考价值。

[[email protected] 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文件的位置 ):

[[email protected] 15:37:39 nginx]# /alidata/server/nginx/sbin/nginx -c /alidata/server/nginx/conf/nginx.conf

 

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

[[email protected] 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
[[email protected] 15:54:27 nginx]# cd logs
[[email protected] 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
[[email protected] 15:54:31 logs]# 

 

以上是关于nginx -s reload "/alidata/server/nginx/logs/nginx.pid" failed的主要内容,如果未能解决你的问题,请参考以下文章

nginx reload无效解决方法

kill -9杀掉nginx主进程、reload失败解决办法

重识Nginx - 16 Nginx reload流程浅析

重识Nginx - 16 Nginx reload流程浅析

nginx reload和reopen

排错集锦3:nginx重启Warning: nginx.service changed on disk. Run ‘systemctl daemon-reload‘ to reload units