2

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.

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.