How To Disable Nginx, Apache, or Varnish from Auto Start In Your Linux Server
This is another 2 cents tip from me on how to stop / disable Nginx, Apache, or Varnish service and remove it from Auto Start entry in Linux Server so it will not start automatically each time your server boot. Why would you need it? Well, that depends and there are many reasons why you have to do that. For example, I firstly installed LAMP stack then added Nginx as reserve proxy to run in front of Apache. Unfortunately, my website and app won’t work properly with that server config. So I decided to stop Nginx and use Apache instead. Then my site works flawlessly until the VPS provider did maintenance and reboot my server. My app won’t work again and once did some checks, my server run Nginx again. Hence I need to disable Nginx including on reboot but I want to keep it installed for further use.
The commands we need are:
First, we need to stop the service from running:
## Stop Nginx /etc/init.d/nginx stop ## Stop Nginx (Alternate command) service nginx stop ## Stop Apache /etc/init.d/httpd stop ## Stop Apache (Alternate command) service httpd stop ## Stop Varnish /etc/init.d/varnish stop ## Stop Varnish (Alternate command) service varnish stop
Of course you need to replace httpd with apache2 on Ubuntu server.
Next, this command allows you to disable either Nginx, Apache or Varnish from running on reboot:
## Disable Nginx chkconfig nginx off ## Disable Apache chkconfig httpd off ## Disable Varnish chkconfig varnish off
Now finally, confirm that you’ve deleted the service from auto start entries:
## Nginx chkconfig --list | grep nginx ## Apache chkconfig --list | grep httpd ## Varnish chkconfig --list | grep varnish
You should see the result is showing “OFF” for all entries.
Thanks for this, I found myself with nginx starting up automatically and somehow clobbering my apache. I didn’t have chkconfig installed on my debian 7 install by default, but once I did this was a very handy option to have in my arsenal and solved my specific immediate need.
hello, where should i input this commands. i’m new to this so i don’t know where to configure my pc.