Does anyone know how to use Mongrel to create virtual hosts? My
production site will have all kinds of domains pointing to it, and I
also need to figure out how to do subdomains. Rails should react to
the host name, doing a lookup based on the name and pull different
records from the database based on this.
For example, I'd like www.mysite.com to point back to 127.0.0.1:3000,
and the same for username.productionsite.com.
I'm using OS X Leopard
Any references or council will be appreciated, thanks in advance!
groove
You might consider switching to Passenger for stuff like this. This is
how our team is tackling this without much effort. Takes just a few
minutes to setup/switch. Here is a writeup on it (for OS X).
http://www.robbyonrails.com/articles/2009/02/11/switch-to-passenger-mod_rails-in-development-on-osx-in-less-than-7-minutes-or-your-money-back
Cheers,
Robby
Does anyone know how to use Mongrel to create virtual hosts? My
production site will have all kinds of domains pointing to it, and I
also need to figure out how to do subdomains. Rails should react to
the host name, doing a lookup based on the name and pull different
records from the database based on this.
Typically people use nginx, apache etc... to handle the nuts and bolts
side of virtual hosts. There's railscasts on using subdomains (#123 Subdomains - RailsCasts
)
Fred
Both of these are very helpful, thank you both so much.
Does passenger allow for full domain names? Kindof like pseudo-hosts,
like having a full www.alskdfjhdsaf.com pointed back to localhost:
3000?
Is there some way of doing this by hacking the /etc/hosts file?
Groove
Mongrel will respond to everything with the same app. The app, however
has access to A request.env variable which has hostname in it. Inspect
it to find out more.
Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/