nginx 不会重启,apache2 时不时地开始运行(自动)
Posted
技术标签:
【中文标题】nginx 不会重启,apache2 时不时地开始运行(自动)【英文标题】:nginx won't restart, apache2 starts running now and then (automatically) 【发布时间】:2021-05-19 13:53:25 【问题描述】:我有一个运行我的 nodeJS 应用程序的 VPS,使用 nginx 作为反向代理。 VPS 已安装为默认的 Apache。我的应用程序经常停止工作,我通过 ssh 检查我的 vps 并尝试重新启动 nginx:
service nginx restart
但我得到了错误:
nginx.service 的作业失败,因为控制进程以错误代码退出。详见“systemctl status nginx.service”和“journalctl -xe”。
在 Stack Overflow 中寻找解决方案我发现了这篇文章:Nginx: Job for nginx.service failed because the control process exited,其中一个答案说我需要停止 apache,所以我在控制台中写道:
sudo killall apache2
service nginx restart
然后工作正常!!但由于某种原因,apache2 时不时地开始自行运行。有没有办法来解决这个问题??提前致谢。
【问题讨论】:
您是否运行了错误提示的命令?这些输出通常有助于解决此类问题。 【参考方案1】:听起来你需要禁用apache2服务并启用nginx服务。
systemctl stop apache2
systemctl disable apache2
systemctl enable nginx
systemctl start nginx
【讨论】:
以上是关于nginx 不会重启,apache2 时不时地开始运行(自动)的主要内容,如果未能解决你的问题,请参考以下文章