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
| improve this answer | |
  • 1
    I tried sudo update-rc.d -f nginx disable. What is the difference between them? – Alex Malex Aug 17 '12 at 14:15
  • 1
    The difference is that disable is better! :) You got me. It effectively 'makes dpkg aware of your preference to prevent the startup scripts from being executed (because dpkg runs update-rc.d too)'. Credit to @Lekensteyn for the explanation. – SirCharlo Aug 17 '12 at 14:19
  • 1
    I already run disable and then remove. How can I undo it? – Alex Malex Aug 17 '12 at 14:32
  • Umm.. You want to enable autostart now? – SirCharlo Aug 17 '12 at 14:34
  • 4
    sudo update-rc.d nginx defaults; sudo update-rc.d -f nginx disable – SirCharlo Aug 17 '12 at 15:26

use this:

sudo systemctl disable nginx

It will disable it and if you like to stop running service use this:

sudo service nginx stop

works on ubuntu 17.10

| improve this answer | |
  • 2
    it works on ububut 18.04 as well – Amrit Shrestha Oct 1 '19 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.