≡ 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.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 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!

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , , , , , , , , , , , , ,