Tuesday, July 17, 2007

Apache2 proxy on vservers

I have recently changed my internal structure from chroot to vserver, and therefore i was able to split my development system from my live system.

But unfortunately that also meant that there is only one vserver who gets the port 80 requests. I thought a long time about that and decided there must be a possibility to use apache2 as a proxy, but also to use wildcards. (I did not want to have multiple files on different systems).

For that i have installed apache2 on both machines. On the live one i have one configuration file for all proxy requests:

<virtualhost>
ServerName www.sub.example.com
ServerAlias *.sub.example.com

CustomLog sub.example.com-access.log combined
ErrorLog sub.example.com-error.log

ProxyRequests On

<proxy>
Order deny,allow
Allow from live-ip
</proxy>

ProxyPass / http://develop-ip/
ProxyPassReverse / http://develop-ip/
ProxyPreserveHost On
</virtualhost>
That way all Requests are send to the development vserver and i don't have any more headaches about it.

See also:
http://www.debian-administration.org/articles/358
http://kpumuk.info/ruby-on-rails/upgrading-apache-to-version-2-2-in-debian/

No comments: