Search code examples
nginxamazon-ec2recompile

How to stop nginx on my Amazon EC2 instance


I am trying to recompile nginx in order to add the page speed module. Never done anything like this before so a little scared! I am the step after doing "make" where I want to stop nginx. The problem is it seems like it restarts itself because my site never goes down and if I keep running the command it keeps stopping it with a new ID each time:

[ec2-user@ nginx-1.6.0]$ sudo service nginx stop
Stopping nginx: /sbin/service: line 66:  9107 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

[ec2-user@ nginx-1.6.0]$ sudo service nginx stop
Stopping nginx: /sbin/service: line 66:  9131 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

[ec2-user@ nginx-1.6.0]$ sudo service nginx stop
Stopping nginx: /sbin/service: line 66:  9151 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

[ec2-user@ nginx-1.6.0]$ sudo service nginx stop
Stopping nginx: /sbin/service: line 66:  9171 Killed                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}

So now I am scared to do a make install while my Nginx is still running because I know I am supposed to stop it before doing a make install. What should I do?


Solution

  • It looks like there is an upstart script that keeps Nginx up and running. After running this command I was able to stop Nginx:

    sudo initctl stop nginx