I m hosting MediaWiki on machine_1(192.168.0.104). On the hosted machine it works properlly.
From machine_2(192.168.0.103) when I type 192.1.168.104 in the browsers URL it shows up the content of machine_1's /var/www/ folder which includes the wiki/ folder which hosts MediaWiki. Upon clicking on wiki folder the URL gets modified to "localhost/wiki/index.php/Main_Page" which of course will not load as its not hosted on machine_2.
But When I manually modify the URL replacing localhost to machine_1's ip address it does load the hosted wiki but the contents are all screwed up .
Its trying to access "localhost/wiki/.../someFile" when it should actually be trying to load "ipAddress/wiki/../someFile" .
How do I make it work properly?
It appears that MediaWiki is not detecting the server name / IP correctly, so that it ends up thinking that the wiki is hosted on "localhost". Obviously, this will work only when accessing the wiki from the same computer it's hosted on, but not from anywhere else.
The easiest way to fix this is to edit your LocalSettings.php and set $wgServer
explicitly to an appropriate value (or change it, if it's already set there), e.g.:
$wgServer = 'http://192.168.0.104';
However, note that the fundamental cause of this problem may be that your webserver software is somehow misconfigured, and thus reporting an invalid server name to MediaWiki. Even if you can fix the issue for MediaWiki by explicitly setting $wgServer
, the misconfiguration might also cause issues with other web applications hosted on the server, so you might want to look into it.