Apache mod proxy

Apache mod proxy
Lars Sommer, lasg@lasg.dk, 2007-11-08
DISCLAIMER: This is a personal note made for personal usage. It might not be easy usable nor explaining.

Forwarding http requests from main server to jails
Instead of jails, it can be real hosts as well.

(Re)compile apache22 with
MOD_PROXY
MOD_HTTP_PROXY

Include the two modules in httpd.conf

LoadModule proxy_module libexec/apache22/mod_proxy.so
LoadModule proxy_http_module libexec/apache22/mod_proxy_http.so

Use virtual hosts on the main server like this:

ServerName jail.lasg.dk
ServerAlias jail.lasg.dk
ProxyRequests Off
ProxyPass / http://jail.lasg.dk:8000/
ProxyPassReverse / http://jail.lasg.dk:8000/
ErrorLog /var/log/www/jail.lasg.dk_error_log
CustomLog /var/log/www/jail.lasg.dk_access_log common

Add hosts to /etc/hosts

If just redirecting with the IP address, apache can not use name based virtual hosts.

192.168.1.50 jail.lasg.dk test.jail.lasg.dk

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>