≡ Menu

Mediawiki Fix Internal Server Host Names / Redirection In shared Hosting or Proxy Setup

Our customer support wiki runs on an internal host (ip:192.168.1.100:300, hostname a-node100.:300) and it is behind the nginx reverse proxy server. However, our Apache server end up displaying internal server name http://a-node100.:300/, which results into an unexpected redirection and timeouts as http://a-node100.:300/ is not accessible over the Internet. How do I force nginx or apache to use the base URL of our server (http://support.example.com/wiki/)?

No need to edit apache or nginx configuration. You need to setup $wgServer variable manually in LocalSettings.php to override the websever hostname setting. It should be set to the base URL of the server, including protocol and without the trailing slash. (eg, http://www.cyberciti.biz).

You need to use this to create fully-qualified URLs pointing to the wiki when you are behind the reverse proxy / caching server. Edit your $wiki/LocalSettings.php file, enter:
$ cd /var/www/html/wiki/
$ vi LocalSettings.php

You need to only setup base url (avoid using /wiki/ part in url):

$wgServer = 'http://support.example.com';

If you are using https (SSL based nginx) use https url:

$wgServer = 'https://support.example.com';

This is required for shared hosting, reverse proxy, or complex hosting solution. Save and close the file.

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 1 comment… add one }

  • Said December 29, 2010, 4:03 pm

    Hello,

    This blog has a problem with feeds. The last one was published on november 16!

Leave a Comment