1

I installed the docker container in my ubuntu 13.10. Along with this nginx webserver also

installed.But every time i want to type this command

service nginx restart.

so how can i autorun the nginx?

0

Method 1: Start nginx at ubuntu startup

Check runlevel

^_^[root@easyengine:~]# runlevel 
N 2

My ubuntu runlevel is 2 so i'm edit the following file

mv /etc/rc2.d/K20nginx /etc/rc2.d/S20nginx

Now restart the system

Method 2: rc.local Add following line before the exit 0

service nginx start
2
  • Please, could your explain method 1? Why renaming a file fix the issue? – realtebo Feb 1 '19 at 10:23
  • runlevel command check and display current runlevel. Now in above example its runlevl 2 so we need to rename killed K20nginx nginx file with start nginx file S20nginx By default linux start all the runlevl script which start with S and Killed which are start with K More info - miteshshah.github.io/linux/basics/system-initialization/… – Mitesh Shah Feb 2 '19 at 16:33

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.