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/)?

ADVERTISEMENTS

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.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
1 comment… add one
  • Said Dec 29, 2010 @ 16:03

    Hello,

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.