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

Procedures:

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

or

$ 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

Troubleshooting

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.

Aug 062008
 

To install the great Mod_Rails on Gentoo linux it’s as easy as 5 steps.paramedic case studies

Since you are Gentoo user, i don’t need to go to details. You know what you doing. ;)

Update: Mod-rails now works with apache mpm-worker

add this to /etc/portage/package.use

and this to /etc/make.conf

If it tries to install rails 2.2.2, rake, and lots of other gems that you already have installed trough rubygems, then run emerge with –nodeps option

for example mine looks like this:

That’s it.

Now just drop a similar vhost config file inside /etc/apache/vhosts.d/

This is a sample vhost file for a rails app.

My sample deflate.conf,
used to gzip the content

* Update on July 10, 2008.

– Now using gentoo portage to install it. it’s more smooth.

Note:

Personally I found that Thin + nginx uses less memory(Nginx 4MB + each thin server) than
apache + passenger, which uses quite more. (Apache: 50MB + each rails spawner)

Switch to our mobile site