Apache proxypass virtual hosting for backend redirection

apache-2.2mediawikimod-proxyreverse-proxyubuntu-10.04

I have a apache proxy load balancer running. I have a domain wiki.mydomain.com registered to this lb. I am trying to make proxy redirect from wiki.mydomain.com to the backend http://192.168.1.56/mediawiki/ and below is the virtual hosting.

<VirtualHost *:80>
ServerName wiki.mydomain.com
<IfModule mod_proxy.c>

ProxyRequests Off
ProxyPreserveHost On
ProxyVia On

         <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
         </Proxy>


ProxyPass / http://192.168.1.56/mediawiki/
ProxyPassReverse / http://192.168.1.56/mediawiki/
</IfModule>
</VirtualHost>

why ProxyPass / http://192.168.1.56/mediawiki/ doesn't work why ONLY ProxyPass /mediawiki http://192.168.1.56/mediawiki/ works which matching directory. Can't I make it work with above virtual hosting?

Once Again, how do I send all request from wiki.mydomain.com to http://192.168.1.56/mediawiki/ with ONLY mod_proxy WITHOUT using Redirect, Rewrite, Alias. I also don't want to use the virtual hosting done for mediawiki on 192.168.1.56 and so I don't want to proxypass / to virtual hosting on the backend as I have to register a domain for this backend, perhaps not required if has internal DNS server but I don't have internal dns running.

Anybody know how to do this with ProxyPass & ProxyPassReverse?. Thank you!

Best Answer

Can you clarify "doesn't work" - what happens when you have this config in place and try to request a page?

If I remember right, you'll need to change MediaWiki's configuration to work in the changed path, as it's very sensitive about those things. It needs to know where the root is, and right now, it's at /../ - which will certainly cause problems with resource loading.

You'll need to adjust the $wgScriptPath and $wgArticlePath config settings in LocalSettings.php, keeping in mind that this will break the communication of anything talking to the wiki server directly without using the proxy (any links, etc, pointing to /mediawiki/something). If anything does need to talk directly instead of through the proxy, then you'll need to make the paths match via both entry points.