【发布时间】:2019-11-07 16:28:30
【问题描述】:
当我重新启动 nginx 或重新启动 VPS nginx 和 nginx.service 停止。并给出这个错误。 sudo systemctl 启动 nginx nginx.service 的作业失败,因为控制进程以错误代码退出。详见“systemctl status nginx.service”和“journalctl -xe”。
我正在使用 Centos 7.6 并安装了来自 nginx.org 的主线 nginx 最新版本。
[root@host ~]# systemctl status nginx.service * nginx.service - nginx - 高性能网络服务器 已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用) 活动:自 2019 年 6 月 25 日星期二 18:41:49 UTC 起活动(运行); 22 分钟前 文档:http://nginx.org/en/docs/ 进程:670 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS) 进程:691 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS) 主PID:692(nginx) CGroup:/system.slice/nginx.service |-692 nginx:主进程 /usr/sbin/nginx -c /etc/nginx/nginx.conf `-693 nginx:工作进程
6 月 25 日 18:41:49 主机 systemd[1]:正在启动 nginx - 高性能 Web 服务器... 6 月 25 日 18:41:49 主机 systemd[1]:启动后 PID 文件 /var/run/nginx.pid 不可读(还没有?)。 6 月 25 日 18:41:49 主机 systemd[1]:启动 nginx - 高性能 Web 服务器。 [root@host ~]# systemctl restart nginx nginx.service 的作业失败,因为控制进程以错误代码退出。有关详细信息,请参阅“systemctl status nginx.service”和“journalctl -xe”。 [root@host ~]# systemctl status nginx.service * nginx.service - nginx - 高性能网络服务器 已加载:已加载(/usr/lib/systemd/system/nginx.service;已启用;供应商预设:已禁用) 活动:自 2019 年 6 月 25 日星期二 19:04:56 UTC 以来失败(结果:退出代码); 21 秒前 文档:http://nginx.org/en/docs/ 进程:858 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS) 进程:861 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) 主 PID:692(code=exited,status=0/SUCCESS)
6 月 25 日 19:04:56 主机 systemd[1]:正在启动 nginx - 高性能 Web 服务器... Jun 25 19:04:56 host nginx[861]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:33 Jun 25 19:04:56 host systemd[1]: nginx.service: control process exited, code=exited status=1 6 月 25 日 19:04:56 主机 systemd[1]:无法启动 nginx - 高性能 Web 服务器。 6 月 25 日 19:04:56 主机 systemd[1]:单元 nginx.service 进入失败状态。 Jun 25 19:04:56 host systemd[1]: nginx.service failed.
也许是 apache 监听端口:80 (httpd)。如果是如何删除它并在每次启动时将 nginx 设置为默认值。 除此之外,我不知道是什么导致了这个问题。我正在尝试使用 Nginx 作为反向代理。任何有效的解决方案都是有价值的。 这是我第三次安装 Nginx。
【问题讨论】:
标签: nginx server nginx-reverse-proxy nginx-config