Easy installing Nginx + mod_rails passenger OSX

 nginx, osx  Comments Off on Easy installing Nginx + mod_rails passenger OSX
Jun 142009

Requirements:Балки обвязочные

1. XCODE you can download xcode from http://developer.apple.com/tools/xcode/index.html

2. OSX 10.4, 10.5 or 10.6


1. Install Passenger

$ sudo gem install passenger

now check where is passenger installed:

in my case is: /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5

2. Install nginx

If you have nginx from macports, deactivate it in case of conflicts.

You can activate anytime later

$ sudo port deactivate nginx

$ wget http://sysoev.ru/nginx/nginx-0.7.59.tar.gz

$ wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz

$ tar xpf nginx-0.7.62.tar.gz

$ cd nginx-0.7.62

I Recommend using nginx 0.6 series because I had a lot of “502 Bad Gateway” with 0.7 series.

$ wget http://sysoev.ru/nginx/nginx-0.6.37.tar.gz

$ tar xpf nginx-0.6.37.tar.gz

$ cd nginx-0.6.37

$ sudo make

$ sudo make install

$ cd /opt/local/conf

$ sudo cp mime.types.default mime.types

$ sudo cp nginx.conf.default nginx.conf

Edit nginx.conf

$ mate nginx.conf


$ sudo vi nginx.conf

Now edit your /etc/hosts and add the hosts for your local project

$ mate /etc/hosts

3. Start nginx

sudo nginx

4. go to your browser and open project1.local


5. Easy start/restart/stop

add this to your ~/.bash_profile file


1. Nginx is not running

– check the logs

– check if it is really not running:

$ ps aux | grep nginx

2. you see the nginx error “502 Bad Gateway”

– may there is a problem with the /var/folders/ permissions on OSX:

to fix it I did this:

$ sudo find /var/folders/xl/ -name “master” -exec chmod 755 {} \;

$ sudo find /var/folders/xl/ -name “-Tmp-” -exec chmod 755 {} \;

everytime I reboot my mac I had to do that… I still dont know how to fix it…

anybody knows?

That is it for now.

Switch to our mobile site