Nginx: Multiple apps, one domain


#1

Hi all.
I guess I am not the first to encounter this…
I want to deploy some rails apps, using only one domain
(www.mydomain.com), so that www.mydomain.com/app1/… will be mapped to
the app1 directory,
www.mydomain.com/app2/… will be mapped to the app2 directory.

I would like to use nginx + mongrels
I couldn’t figure out how to express this in the nginx config file.
I did something like :

http {
.
.
.

cluster serving app1

upstream mongrel1 {
server 127.0.0.1:7000;
server 127.0.0.1:7001;
}

cluster serving app2

upstream mongrel2 {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
}

server {
.
.
.
location /app1 {
.
.
.
proxy_pass http://mongrel_app1;
}

location /app2 {
.
.
.
proxy_pass http://mongrel_app2;
}
}

}

But this doesn’t work, I get error messages in the production.log files
because the app1 / app2 prefixes are stll there for rails to figure out.

Thanks for your help

Nadav


#2

On Jul 24, 2:22 pm, Nadav B. removed_email_address@domain.invalid
wrote:

http {
upstream mongrel2 {
.
}
Posted viahttp://www.ruby-forum.com/.
take a look at the prefix option with mongrel:

http://mongrel.rubyforge.org/docs/howto.html


#3

alex durgin wrote:

take a look at the prefix option with mongrel:

http://mongrel.rubyforge.org/docs/howto.html

Thanks man, this was the problem. I added the prefix option to
config/mongrel_cluster.yml in each of the applications directories and
now it works fine.

Cheers

Nadav