----- "Joost de Heer" <joost@xxxxxxxxxxxxxxxxx> wrote: > On 29-12-2010 20:00, Michelle Konzack wrote: > > Hello *, > > > > On my gateway I use a bunch of files (currently 1782) like Why a single file for each of these? > > ----8<------------------------------------------------------ > > <VirtualHost 88.168.69.36:80> > > ServerName $HOST_NAME > > > > ProxyRequests off This is default. > > ProxyVia on Set this in server context. > > ProxyPass / http://$HOST_IP/ > > ProxyPassReverse / http://$HOST_IP/ > > ProxyPreserveHost on Set this in server context. > > <Proxy *> > > Order deny,allow > > Allow from all > > </Proxy> This should be default, unless we're talking Debian... http://wiki.apache.org/httpd/DebianDeb0rkification > > </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? Before asking such a question, you should ask yourself, *why* does it consume so much memory? What MPM are you using, what MPM settings do you have. What modules do you have loaded, what other than proxying does your server do? How much load is on the server, etc... > 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] # this should make the rewrite rule more efficient. RewriteRule ^ http://%1$0 [P,L] But as a whole I believe mod_rewrite decreases readability. I don't think it will do any thing much in terms of reducing memory foot print. Walking the vhost chain is a core feature and should work efficiently out of the box. If it doesn't something's off. I much prefer mod_macro: ProxyVia on ProxyPreserveHost on <Macro ProxyVHost $servername $server_ip $remote_ip> <VirtualHost $server_ip:80> ServerName $servername ProxyPass / http://$remote_ip/ ProxyPassReverse / http://$remote_ip/ </VirtualHost> </Macro> # then you have one line -- not one file! -- per vhost: Use example.org 88.168.69.36 10.1.42.36 Use example.net 88.167.70.37 10.2.43.37 Use example.com 88.166.71.38 10.3.44.38 Use example.edu 88.165.72.39 10.4.45.39 Not sure if the rewrite method, or this method help reduce memory foot print, they will definately reduce the effort on startup, etc... I still think that the memory footprint is caused by something entirely unrelated to what you're describing. > Joost i -- Igor GaliÄ Tel: +43 (0) 664 886 22 883 Mail: i.galic@xxxxxxxxxxxxxx URL: http://brainsware.org/ --------------------------------------------------------------------- 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@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx