I went through some manuals and I didn't understand yet. How do I disable autostart nginx service?
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? – Alex Malex Aug 17 '12 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. – SirCharlo Aug 17 '12 at 14:19 -
1
-
-
4
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
-
2
-
If 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
. – Félix Saparelli Sep 12 '20 at 12:26