Drew Friestedt's picture

when I installed mediawiki for the first time I selected a domain name:


my local IP is 192.168.X.XXX

When I navigate to the local IP address to work on mediawiki, it forwards me to the domain name which is NOT routable to my local infrastructure.  That is a public domain I just setup to test.  It's almost as if DNS on webmin is forwarding traffic from 192.168.X.XXX to the public domain.

How do I remove this domain name so that when I visit 192.168.X.XXX I do not get forwarded to the domain I setup during install?

Jeremy Davis's picture

Unfortunately, recent updates in MediaWiki require it to have a domain set. The main issue which was hit was some internal redirection links did not work. One example was that if a user is redirected to log in when following a link to some wiki content, after login, they will not be redirected to the desired page.

However, it should be possible to set it to explicitly use an IP address where you were asked for a domain. TBH, I haven't explicitly tested that with Mediawiki, but would expect it to work.

To test that out, rerun the Mediawiki inithook and set the "domain" to the IP address (obviously make sure that you have set a static IP first). You can rerun that interactively, like this:


Or possibly even easier, non-interactively like this:

/usr/lib/inithooks/bin/mediawiki.py --pass='ADMIN_PASSWORD' --domain='xxx.xxx.xxx.xxx'

(where ADMIN_PASSWORD is the password you want for the admin account, can be the same as your existing password; and xxx.xxx.xxx.xxx is your static IP address).

Other alternatives are:

  • If you have a local DNS, you could add an entry for the desired domain for your server to that (and reset the Mediawiki domain as per above if need be). All non-specified domains should be forwarded to an external DNS server (so the internet still works...).
  • If there aren't too many users, you could add a hosts file entry for your server (essentially overriding DNS for your mediawiki domain) to each computer. That's fine for testing and for very small installations, but impractical for larger ones.

If you are only using it for internal usage of a trusted network, then you may also wish to remove the redirection to https. I would only do that if you can completely trust everyone who has or will have access to your network. And/or you make a point of only logging in via https. Any interactions with your server via http (including log in passwords, etc) could be easily intercepted by anyone with the know-how. A malicious actor (disgruntled employee?) with the Admin password could certainly cause some damage to your wiki!

FWIW to remove the redirection to https, you'll need to edit the http section of /etc/apache2/sites-available/mediawiki.conf, removing lines 6-8. Then restart Apache:

service apache2 restart

If setting the IP doesn't work, please let me know as I have another idea...

Add new comment