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

by on December 19, 2010 · 1 comment· last updated at January 27, 2012

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.



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 1 comment… read it below or add one }

1 Said December 29, 2010 at 4:03 pm

Hello,

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

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: