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

If you would like to be notified the next time I write something, you can subscribe with your choice of RSS or Email.

I promise not to spam you and you can unsubscribe at anytime.

Also, here are some other items you might like longer longer:

or go see everything in the archive.