Nginx and Mongrel cluster on debian 5 comments
Nginx is a ‘small’ efficient http, load balancer server. More and more popular in Rails community, it’s a good front end for mongrel clusters. It’s seems to be a good replacement for apache, at least for the memory usage (on my test: 1 process use 1.3M against the more than 9M taken by 1 apache process). Benchmark on one single server are quite similar.
The process has been tested on debian 4.0r1 and should work on Ubuntu.
Installation
apt-get install nginxor, if you want an up to date product:
1/ Prepare your system
apt-get install zlib1g-dev libgcrypt11-dev libpcre3-dev libssl-devtar xzf nginx-0.6.12.tar.gz
cd nginx-0.6.123/ Compile it
./configure --pid-path=/usr/local/nginx/logs/nginx.pid \
--sbin-path=/usr/local/sbin/nginx \
--with-md5=/usr/lib \
--with-sha1=/usr/lib \
--with-http_ssl_module \
--with-http_dav_module --prefix=/usr \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log
make
sudo make installConfiguration
The following configuration is for 1 nginx server with load balancing 3 mongrel in cluster:
1/ Mongrel cluster configuration
gem install mongrel_cluster -y
cd /var/www/my-app-path/current/configures 3 mongrel in cluster, in production mode, starting at port 5000 and listening on localhost
sudo mongrel_rails cluster::configure -e production \
-p 5000 -N 3 -c /var/www/my-app-path/current/ -a 127.0.0.1 \
--user www-data
mongrel_rails cluster::start2/ Nginx
nano /etc/nginx.confUse the nginx.conf file from brainspl.at website, change the 2 or 4 (if you use ssl) references to the path of your application (/var/www/my-app-path/current/)
/etc/init.d/nginx startAll these information come from many website (thanks to all), I put them together for my own usage, hope it’s helpfull.





I think you’re forgetting the ‘make ; sudo make install’ part???
hehe thanks for the comments.
You can now do:
apt-get install mongrel-cluster
I really like more the apache proxy balancer, and mongrel cluster deploy.