Computer

Apache mod proxy on FreeBSD

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:
<VirtualHost *:80>
  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
</VirtualHost>

---

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

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *