Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One rails application for multiple domain names

I have one rails application needed to be deployed by passenger module nginx. This application needs to be served for hundred domain names. I don't have enough memory to launch hundred rails instances. I'm not sure the proper way to launch rails in few instances. It's the same application under different domain names.

server {
    listen 80;
    server_name www.a_domain.com;
    root /webapps/mycook/public;
    passenger_enabled on;
}
server {
    listen 80;
    server_name www.b_domain.com;
    root /webapps/mycook/public;
    passenger_enabled on;
} 
server {
    listen 80;
    server_name www.c_domain.com;
    root /webapps/mycook/public;
    passenger_enabled on;
}

As you can the above code, it would launch three rails instances. It would be nice to launch only instance to serve under these 3 domain. Anyone has some suggestions?

like image 677
Chamnap Avatar asked Jan 21 '23 12:01

Chamnap


1 Answers

Just set up multiple domain aliases for that server entry.

server {
    listen 80;
    server_name www.a_domain.com www.b_domain.com www.c_domain.com;
    root /webapps/mycook/public;
    passenger_enabled on;
}

That'll serve requests to each of those domains, and all hit the same app pool.

like image 148
Chris Heald Avatar answered Jan 31 '23 05:01

Chris Heald