I went through some manuals and I didn't understand yet. How do I disable autostart nginx service?
2 Answers
Try this command:
sudo update-rc.d -f nginx disable
-
1I tried
sudo update-rc.d -f nginx disable
. What is the difference between them? Aug 17, 2012 at 14:15 -
1The difference is that
disable
is better! :) You got me. It effectively 'makesdpkg
aware of your preference to prevent the startup scripts from being executed (becausedpkg
runs update-rc.d too)'. Credit to @Lekensteyn for the explanation. Aug 17, 2012 at 14:19 -
1
-
-
4
sudo update-rc.d nginx defaults; sudo update-rc.d -f nginx disable
Aug 17, 2012 at 15:26
Update:
I made changes to supports more distributions:
use this:
sudo systemctl disable nginx
It will disable it and if you like to stop running service use this:
sudo systemctl stop nginx
works on Ubuntu and any Systemd based distributions
-
3
-
1If you're going to use systemd style, use it for everything, don't have some weird mashup of using the
service
shim for some commands. That second one should just besudo systemctl stop nginx
. Sep 12, 2020 at 12:26 -
-
1