0

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!

user53864
  • 1,723
  • 11
  • 37
  • 66

1 Answers1

0

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.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • I am getting error page `page not found`. And in the address it's changing to `http://wiki.mydomain.com/mediawiki/index.php?...`. Directly `http://192.168.1.56/mediawiki/` is accessible and I think it changes the address location. – user53864 Feb 08 '12 at 00:41
  • Right - it's configured to do so. See the third paragraph of the answer. – Shane Madden Feb 08 '12 at 01:25
  • Is there any possible way having both accessing directly and also via proxy? – user53864 Feb 08 '12 at 01:35
  • @user53864 Yes; if you can make the paths match. Is there anything else on the server that mediawiki is running on, or can you just move it from `/mediawiki/` to `/`? – Shane Madden Feb 08 '12 at 01:37
  • paths matching hmm.... if paths should match then no way other than doing virtual hosting on 192.168.1.56 and so I should register one more domain. Probably virtual hosting with internal domains can do instead registering domain but I should have DNS installed and running but I don't have and it's cloud servers. Yes, there are other apps also running on 192.168.1.5. Just wondering why proxypass redirect exactly like it's said with haproxy. – user53864 Feb 08 '12 at 03:04
  • Is this only problem with mediawiki links or it doesn't work for anything that won't match directive/path if I try with above virtual hosting? – user53864 Feb 08 '12 at 17:53
  • Anything that's happy with relative pathing below the root of what you've redirected will work just fine. This is a configuration issue with your MediaWiki installation. – Shane Madden Feb 08 '12 at 18:03
  • Besides loadbalancer, doing a virtual host also on the backend does the work it seems. Yes, I mentioned in the post that I don't wan to do vhost on the backend because I thought I have to register one more domain for this and then use this complete domain(/) in the load balancer vhost. I think it's not required, I can use the same domain name in the backend though it's pointing it to lb and I do proxypass / to backend ip directly on the lb – user53864 Feb 17 '12 at 01:04