Apache2 reverseproxy – How to set a DocumentRoot on the server

apache-2.2documentroot

I've configured a reverseproxy with apache2. The reverseproxy configuration looks like this:

<VirtualHost *:80>
    ServerName someserver.com

    ProxyRequests Off

    ProxyPass /             http://123.123.123.123/var/www/someserver.com/htdocs/
    ProxyPassReverse /      http://123.123.123.123/var/www/someserver.com/htdocs/
</VirtualHost>

<VirtualHost *:80>
    ServerName subdomain.someserver.com

    ProxyRequests Off

    ProxyPass /             http://123.123.123.123/var/www/someserver.com/subds/subdomain/
    ProxyPassReverse /      http://123.123.123.123/var/www/someserver.com/subds/subdomain/
</VirtualHost>

So now I would like to set diffrent document roots for both virtual hosts on the server (123.123.123.123). I tried to set up virtual hosts on the server but the ServerName-Direktive doesn't work.

Has anybody an idea how i can solve this problem? Im sure there is a simple solution but I don't see it 😛
Thanks

Best Answer

You need to use the ProxyPreserveHost Directive instead, you cannot hard code the document roots like that.

Related Topic