[Locomotive-users] dynamic subdomains

Ray Baxter ray at warmroom.com
Thu Aug 9 00:33:00 GMT 2007


alarkspur wrote:
> I understand,
>
> but that happens if the users register in the data base.
> I need to insert a registry in /etc/host by each user?
> RoR can write automatically in the /etc/host file???
No, you do it the other way around.

On your production system, you use wild card DNS. If your application is 
at example.com, then you configure your name server to return the IP 
address of example.com for fred.example.com, sue.example.com, and 
any.other.unspecified.domain.example.com. You will need to talk to 
whomever provides the name service for your domain about implementing 
wild card DNS.

RoR, and your web server need to be configured to handle the routing of 
the subdomains, but it sounds like you have this part covered. In case 
you don't there is a page on wiki.rubyonrails.org that explains it. That 
page may be a little dated, but it should get this started.

To do this on your localhost you need to make specific entries in your 
/etc/hosts file as Lori mentioned, or set up a nameserver on your 
localhost that does wild card DNS for localhost.

Ray


More information about the Locomotive-users mailing list