nginx服务访问失败,
然后想着重启,
nginx -s reload
但是报错
ginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2020/11/27 15:32:47 [warn] 2793#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:6
2020/11/27 15:32:47 [notice] 2793#0: signal process started
2020/11/27 15:32:47 [error] 2793#0: open() "/run/nginx.pid" failed (2: No such file or directory)
然后切换到root用户
但是报下面这个错误
nginx -s reload
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
其实直接启动nginx就可以了
执行
nginx
nginx (执行该命令之后,nginx 会在 /usr/local/var/run/ 路径下创建一个名为nginx.pid 的文件 )
其实是之前有pid文件,不知道为什么被stop了,nginx -s stop (删除pid文件)
在stop后,使用reload启动nginx便会报错,此时使用nginx直接启动便可。
本文记录了一次解决Nginx服务无法启动的问题过程。主要问题是由于权限不足导致的错误日志文件和PID文件无法创建。通过切换到root用户并直接启动Nginx服务解决了问题。
7108

被折叠的 条评论
为什么被折叠?



