I just installed nginx on Ubuntu 16.04. The trouble is, I only want to start it manually, never automatically on runlevel.

I found lots of entries about how to get it to run on different runlevels, but not to prevent running on all of them.

So, I guessed and did this:

# Provides:   nginx
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:
# Default-Stop:      0 1 2 3 4 5 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon


/etc/init.d$ sudo update-rc.d nginx defaults
insserv: warning: current start runlevel(s) (2 3 4 5) of script `nginx' overrides LSB defaults (empty).
insserv: warning: current stop runlevel(s) (0 1 6) of script `nginx' overrides LSB defaults (0 1 2 3 4 5 6).

which looks to me like my changes didn't work.

How do I shut this off?

  • 2
    update-rc.d is Upstart / SysVInit, and default 16.04 is SystemD, are you using SystemD for your init system, or the older ones?
    – Thomas Ward
    Sep 2, 2016 at 0:18
  • @ThomasWard sorry, didn't know that it wasn't upstart.
    – Thom
    Sep 2, 2016 at 0:20
  • No problem! I've written an answer for SystemD, but without knowing how you installed nginx, it may or may not work. Did you install from the repositories, or from the PPA (apt / apt-get), or did you install from source code (download the source code and compile)?
    – Thomas Ward
    Sep 2, 2016 at 0:21
  • @ThomasWard Sorry, I installed using apt-get.
    – Thom
    Sep 2, 2016 at 0:40
  • then you should be good with the answer below. If not, let me know :)
    – Thomas Ward
    Sep 2, 2016 at 0:45

1 Answer 1


This answer assumes you are using the default init system in 16.04, which is SystemD.

Borrowing from DigitalOcean's SystemD guide, you can disable nginx autoboot with this:

sudo systemctl disable nginx.service

This should disable autostart of the service at boot like the older update-rc.d functionality provided. (Note that with SystemD, update-rc.d isn't going to be as useful)

  • I get the error "Excess Arguments"
    – Thom
    Sep 2, 2016 at 10:59
  • @Thom I provided the wrong command - please check again and see if the updated command works.
    – Thomas Ward
    Sep 2, 2016 at 11:52

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.