Rails 3 Subdomain with Nginx and Unicorn Rails 3 Subdomain with Nginx and Unicorn nginx nginx

Rails 3 Subdomain with Nginx and Unicorn


It seems that under my setup in production request.subdomain was set to 'admin.mydomain' whereas in development it was just 'admin'.

Therefore adding this into the routes.rb with a regex works both locally and on my production server:

constraints :subdomain => /admin.*/ do  scope :module => "admin" do    root to: 'admin#index'  endend