Search code examples
ruby-on-railsrubyamazon-s3subdomain

Rails subdomains for different evironments


I have a rails app, that I am currently shifting to production. But I want to setup a subdomain such that, if I goto : dev.myapp.com , I reach the development environment & if I goto prod.myapp.com , I reach the production environment

Will I have to use 2 instances for this purpose, or can this managed by one?

My servers are on AWS, and domain is managed by GoDaddy


Solution

  • You can definitely use both environments on the same server but you would have to have 2 different instances running.

    You can use nginx or Apache HTTPD to route the different domains (or sub-domains) to the actual instance running on your server (if it's an AWS EC2).

    You have several other ways to configure it depending on your setup.