简体   繁体   中英

nginx won't restart, apache2 starts running now and then (automatically)

I have a VPS running my nodeJS app, with Nginx as reverse proxy. The VPS has installed as default Apache. Often my app stops working, i check my vps through ssh and i try to restart nginx:

 service nginx restart

But i got the error:

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

Looking for a solution in Stack Overflow i found this post: Nginx: Job for nginx.service failed because the control process exited where an answer says that i need to stop apache, so i write in console:

 sudo killall apache2 service nginx restart

And then works fine.? But for some reason apache2 starts running on its own now and then? Is there a way to fix this.? Thanks in advance.

It sounds like you needs to disable the apache2 service and enable the nginx service.

systemctl stop apache2
systemctl disable apache2

systemctl enable nginx
systemctl start nginx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM