Auto Starting Nginx With Rvm And Passenger

Jun 12, 2013

If there is one thing that drives me nuts, it’s trying to figure out what isn’t running after a server reboot. I wish I had all the time back from grepping through history to see what services were started manually.

The problem with installing nginx through passenger and rvm is it doesn’t behave like a normal install. The usual startup script doesn’t work.

This script works pretty good for me, so I thought I would share it here. There is also a GitHub repo with instructions. This is all thanks to

1) Create shell script in /etc/init.d

sudo vim /etc/init.d/

2) Paste in this text:

# this script starts the nginx process attached to passenger
sudo /opt/nginx/sbin/nginx

3) Make it executable

sudo chmod +x /etc/init.d/

4) Run it to make sure it works

5) Update the init script links sudo update-rc.d defaults

More stuff:

or go see everything in the archive.