Multiple sites with mongrel and nginx

I’ve got a standard nginx config (http://www.urbanpuddle.com/nginx.conf)
which I use to server one php app and one rails app. My
mongrel_cluster.yml file resides in /etc/mongrel_cluster and is a
symlink to my_app1’s config/mongrel_cluster.yml file. That file looks
like this:


cwd: /var/www/my_app1
port: 8000
environment: production
group: www-data
user: www-data
address: 127.0.0.1
pid_file: log/mongrel.pid
servers: 3

All is great and works fine, but I’m wondering how to extend this to be
able to run multiple rails apps at the same time? Do I have to modify
my nginx.conf like so?

#for my_app1
upstream mongrel {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}

#for my_app2
upstream mongrel {
server 127.0.0.1:8100;
server 127.0.0.1:8101;
server 127.0.0.1:8102;
}

And if I do, how do I modify the mongrel_cluster file so it knows to
launch both mongrel clusters?

Thanks in advance…

I guess I’ll partially answer my own question…

I made the changes to nginx.conf and started the mongrel clusters
manually with sudo mongrel_rails cluster::start and it works. Still, it
would be nice to know if it’s possible to fire off 2 different mongrels
via the /etc/init.d/mongrel_cluster start command…

/etc/init.d/mongrel_cluster:

set CONF_DIR to the directory containing your mongrel configurations,
then

/etc/init.d/mongrel_cluster restart

does a full restart of all the clusters on the box.

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs