views:

142

answers:

1

I want to point several domain names to the same Rails application. The content is different for each domain, but the functionality and the structure of the application is the same.

What is the best way to do this when it comes to server set up and routing? I will use nginx as a web server.

+3  A: 

if layout needs to be changed only: add to application controller

layout :setup_layout
def setup_layout
  if request.host == "site1.host.tld"
     "layout1"
  else
     "layout2"
  end
end

the same logic you can use to get content, this is true if all sites will use one database.

In nginx conf add more hosts to server_name directive:

server_name site1.host.tld site2.host.tld
VitalieL