Install MacPorts if you don’t have it.
Download and install the Portfile
1 2 3 | |
You need to have ruby installed to compile passenger. In case you don’t have ruby, you can also get it from macports.
1
| |
If you have an older version of nginx installed using macports, it might move nginx.conf to nginx.conf.altered. Copy it back to nginx.conf if you need it. You can also use this nginx.conf.
Edit /opt/local/etc/nginx.conf and add the following lines inside http {}
1 2 | |
Change the ruby path if you’re not using ruby from macports.
For each rails app, you need to add the following, also inside http {}
1 2 3 4 5 6 7 8 | |
Check if your syntax is correct.
1
| |
If it is, you’ll see
1 2 | |
Start nginx with
1
| |
You won’t get any output if it starts correctly. Check if nginx is running
1 2 3 4 5 | |
MacPorts added a startup item which is disabled by default. To start it,
1
| |
You can stop nginx with
1
| |
but it would just be started right away. If you want it to remain stopped, use
1
| |
When you make changes to the config, reload the config with
1
| |
Check the other nginx options using
1
| |
One more thing… When you add a rails or rack app, you need to specify a different server_name. You need to add it to /etc/hosts
1
| |
Don’t you think it would be great if you can handle this automatically? Me too. Stay tuned for more. This shouldn’t be a pane pain. ;)