重启了服务器后,启动nginx失败:

$ nginx -s reload
nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

错误说的文件:/usr/local/nginx/logs/nginx.pid定义的pid值是”“,是一个非法的pid数值.

解决办法

重新指定nginx的配置文件即可:

$ sudo nginx -c /usr/local/nginx/conf/nginx.conf
$ sudo nginx -s reload

完美解决!

参考: nginx: [error] invalid PID number “” in “/run/nginx.pid”