httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joost de Heer <jo...@sanguis.xs4all.nl>
Subject Re: [users@httpd] Searchin better solution as mod_proxy/vhost
Date Wed, 29 Dec 2010 21:15:56 GMT
On 29-12-2010 20:00, Michelle Konzack wrote:
> Hello *,
>
> On my gateway I use a bunch of files (currently 1782) like
>
> ----8<------------------------------------------------------
> <VirtualHost 88.168.69.36:80>
>      ServerName          $HOST_NAME
>
>      ProxyRequests       off
>      ProxyVia            on
>      ProxyPass           / http://$HOST_IP/
>      ProxyPassReverse    / http://$HOST_IP/
>      ProxyPreserveHost   on
>      <Proxy *>
>          Order           deny,allow
>          Allow           from all
>      </Proxy>
>   </VirtualHost>
> ----8<------------------------------------------------------
>
> and it works perfectly, but i disike the memory consumation of apache2.2
> so, my question is:
>                          How can I do this better?

With mod_rewrite and rewritemap. It should look something like this 
(untested):

urlmap.txt [textfile]
host1		ip1
host2		ip2
host3		ip3
.
.
.

httpd.conf:
RewriteEngine On
RewriteMap urlmap txt:/path/to/urlmap.txt
# Only rewrite if there is a host header
RewriteCond %{HTTP_HOST} !^$
# Lowercase the hostheader
RewriteCond ${lowercase:%{HTTP_HOST}} ^(.+)$
# Rewrite only if there is an entry in the urlmap
RewriteCond ${urlmap:%1} ^([0-9].*)$
RewriteRule /(.*) http://%1/$1 [P,L]

Joost

---------------------------------------------------------------------
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


Mime
View raw message