I have a new client with a project that will be organized a lot like
“blogspot.com” (aka blogger) where there are a large number of content
providers, and each one of those people gets their own subdomain off the
main “blogger.com” domain.
The obvious (though perhaps not the best) way to do this is to have the
Rails app create a new virtual host block in the apache config for each
one of these content providers and their subdomain.
My concern is that the vHosts in Apache were probably designed as a way
to have two or three, maybe a half dozen or more separate things running
on the server…but a few thousand!!!
Does anyone have any experience putting thousands of vHosts into an
apache config? Does this scale that high without creating some sort of
stability or speed problems? Do you need gobs 'o RAM for the apache
server to keep track of all those vHosts? Does it take hours for the
Apache server to start up?
Does anyone have a suggestion for a much better way to do this? Am I
re-inventing an existing wheel?
many thanks for your wisdom.
thanks,
jp
You can use a wildcard in apache’s configuration
ServerName blogger.com
ServerAlias *.blogger.com
Then in rails you can access the subdomain(s) via request.subdomains
A similar approach is spelled out at:
http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys
On Sun, Jul 27, 2008 at 3:20 PM, Jeff P.
Shawn Balestracci wrote:
You can use a wildcard in apache’s configuration
ServerName blogger.com
ServerAlias *.blogger.com
Then in rails you can access the subdomain(s) via request.subdomains
A similar approach is spelled out at:
http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys
On Sun, Jul 27, 2008 at 3:20 PM, Jeff P.
Very cool! Thanks Shawn!
I wonder, can you do . and also get the domain?
(naturally, he wants to allow some customers to register a domain name
and use that as well)
thanks again!
jp
On Mon, 2008-07-28 at 00:20 +0200, Jeff P. wrote:
My concern is that the vHosts in Apache were probably designed as a way
to have two or three, maybe a half dozen or more separate things running
on the server…but a few thousand!!!
Does anyone have any experience putting thousands of vHosts into an
apache config? Does this scale that high without creating some sort of
stability or speed problems? Do you need gobs 'o RAM for the apache
server to keep track of all those vHosts? Does it take hours for the
Apache server to start up?
On RubyForge we have over 6000 virtual hosts configured inside one
Apache server and haven’t seen any problems. Restarts take 10-15
seconds. The machine has 8 GB of RAM, but Apache doesn’t use much of it
since the virtual hosts are mostly static content.
Yours,
Tom
Tom C. wrote:
On Sun, 2008-07-27 at 20:52 -0400, Tom C. wrote:
On RubyForge we have over 6000 virtual hosts configured inside one
Apache server and haven’t seen any problems. Restarts take 10-15
seconds. The machine has 8 GB of RAM, but Apache doesn’t use much of it
since the virtual hosts are mostly static content.
That said, I think Shawn’s suggestion is probably the way to go,
Yours,
Tom
Thanks Tom. Interesting that it can handle that many with ease.
May use Shawn’s method for the subdomains and vHosts for all of the
user-registered domains.
jp
On Sun, 2008-07-27 at 20:52 -0400, Tom C. wrote:
On RubyForge we have over 6000 virtual hosts configured inside one
Apache server and haven’t seen any problems. Restarts take 10-15
seconds. The machine has 8 GB of RAM, but Apache doesn’t use much of it
since the virtual hosts are mostly static content.
That said, I think Shawn’s suggestion is probably the way to go,
Yours,
Tom