You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Adi Linden <ad...@adis.on.ca> on 2004/01/20 00:06:33 UTC

Re: AW: [users@httpd] VirtualHost and Memory Consumption

> So maybe it would help not to have 6058 virtual hosts but only 1 ?

I'll be giving this a try.

> Maybe you could use mod_rewrite to change username.server.tld to
> server.tld/~username and let everything else be done by the module that
> handles user's home pages ?

Yes, I am looking at mod_rewrite to see if this helps. I don't think the 
current build I am using supports mod_vhost_alias.

Adi




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: AW: [users@httpd] VirtualHost and Memory Consumption

Posted by Adi Linden <ad...@adis.on.ca>.
On Tue, 20 Jan 2004, Robert Andersson wrote:
> I tweaked it for your situation, and so might be broken. It would either
> redirect a.b.c to www.a.b.c or www.a.b.c to a.b.c. I think this is good
> strategy, as you don't have more than one name for a site.

Thank you for all the suggestions. This is what I cooked up and tested, a 
combination of what I read in the apache docs and learned here.

  # Bulk rewriting for users virtual hosts
  RewriteEngine On

  # Do some useful logging (optional)
  #RewriteLog /var/log/httpd/rewrite_log
  RewriteLogLevel 0

  RewriteMap   lowercase  int:tolower

  RewriteCond  %{REQUEST_URI}                !^/icons/
  RewriteCond  ${lowercase:%{SERVER_NAME}}   !^www\.sample\.org$
  RewriteCond  ${lowercase:%{SERVER_NAME}}   ^([0-9a-z-]+)\.sample\.org$ [OR]
  RewriteCond  ${lowercase:%{SERVER_NAME}}   ^www\.([0-9a-z-]+)\.sample\.org$
  RewriteRule  ^(.+)                         /home/%1/public_html/$1

Thanks,
Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: AW: [users@httpd] VirtualHost and Memory Consumption

Posted by Robert Andersson <ro...@profundis.nu>.
Adi Linden wrote:
> > So maybe it would help not to have 6058 virtual hosts but only 1 ?
>
> I'll be giving this a try.
>
> > Maybe you could use mod_rewrite to change username.server.tld to
> > server.tld/~username and let everything else be done by the module that
> > handles user's home pages ?
>
> Yes, I am looking at mod_rewrite to see if this helps. I don't think the
> current build I am using supports mod_vhost_alias.

You can combine mod_rewrite and mod_vhost_alias to do some magic. I have
proposed a few times on the list how to handle the optional www. host
problem. As I am not very familiar with your requirements, I just give this
as an example:

    <VirtualHost *>
        ServerName anything
        RewriteEngine On
        # If host is only three part, we add www and ask visitor to come
again
        RewriteCond %{SERVER_NAME} ^([\w-]+\.[\w-]+\.[\w-]+)$
        RewriteRule (.*) http://www.%1$1 [R]
        # Or, we can do the other way around, and remove www.
        RewriteCond %{SERVER_NAME} ^www\.([\w-]+\.[\w-]+\.[\w-]+)$
        RewriteRule (.*) http://%1$1 [R]
        # ...
        VirtualDocumentRoot /home/%-3.0/public_html
    </VirtualHost>

I tweaked it for your situation, and so might be broken. It would either
redirect a.b.c to www.a.b.c or www.a.b.c to a.b.c. I think this is good
strategy, as you don't have more than one name for a site.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org