git clone git://github.com:crigor/admoolabs-ports.git ports
cd ports/nginx-0.7.64-passenger-2.2.8
sudo port -v install
You need to have ruby installed to compile passenger. In case you don’t have ruby, you can also get it from macports.
sudo port -v install ruby
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 {}
Installing Nginx with Passenger on Snow Leopard Using MacPorts
Install MacPorts if you don’t have it.
Download and install the Portfile
You need to have ruby installed to compile passenger. In case you don’t have ruby, you can also get it from macports.
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 {}
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 {}
server { server_name labs.local; root /Users/crigor/admoolabs/labs/public; access_log /opt/local/var/log/nginx/labs.local.access.log; error_log /opt/local/var/log/nginx/labs.local.error.log; passenger_enabled on; rails_env development; }Check if your syntax is correct.
If it is, you’ll see
Start nginx with
You won’t get any output if it starts correctly. Check if nginx is running
MacPorts added a startup item which is disabled by default. To start it,
You can stop nginx with
but it would just be started right away. If you want it to remain stopped, use
When you make changes to the config, reload the config with
Check the other nginx options using
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
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
panepain.