Manual talk:$wgServer

If you've just installed MediaWiki, and you are getting submit errors when you attempt to edit a page, and get "The page cannot be found" with the URL specified as

h ttp://localhost/mywikipedia/index.php?title=Page&action=submit

check the apache-error.log to see if you see an error such as:

[error] [client 10.32.223.71] File does not exist: C:/wamp/www/mywikipedia/ localhostlocalhost

Note how "localhost" is listed twice. Go into your www\mywikipedia\LocalSettings.php file and change $wgServer from:

$wgServer = 'localhost';

to

$wgServer = '';

Restart the servers.

This will clear the error and have edit/submits work properly.


 * That would produce incorrect URLs; instead simply format the value correctly! Include the protocol part of the URL, like so: 'http://localhost'. --Brion VIBBER 23:08, 17 November 2006 (UTC)

History
Is the history section of this page really neccessary, if I were coming to here for information about this setting (the primary purpose of this manual) a section on the history would be quite irrelevant. Any developer looking here would probably find it equally useless as the current version appears to work fine. Appoligies if I am overlooking something. Lcarsdata (Talk) 15:05, 17 March 2007 (UTC)


 * It matters if you are not using the latest version of MediaWiki. --HappyDog 13:55, 2 April 2007 (UTC)

Use server name and port from request URL?
Is there any way to make Mediawiki use the server name given in the request URL? E.g. if I'm accessing the wiki as http://foo/wiki then I want all URLs in redirects etc. to be http://foo/wiki. However if I use http://bar:8080/wiki I want all URLs generated to be http://bar:8080/wiki. (Yeah, this is to allow tunneling through various networks in weird ways.)

httpd.conf
It would be helpful if there was a link to a resource on configuring httpd.conf correctly.

Set by installer/Automatic setting of this parameter
This variable is set by the installer in version 1.18 but I do not think this is also true of version 1.17. If I am wrong please specify the first version (ie 1.17.2) this is in. Allen4names (talk) 16:37, 28 March 2012 (UTC)
 * I changed to 1.17 since a fresh install of 1.17.3 set this parameter. Was it backported? --&#91;&#91;kgh&#93;&#93; (talk) 16:38, 28 March 2012 (UTC)
 * Are you sure it was version 1.17.3? Please check for the following lines in "mediawiki-1.17.3/includes/installer/LocalSettingsGenerator.php".

\$wgServer          = \"{$this->values['wgServer']}\";
 * 1) The protocol and server name to use in fully-qualified URLs
 * I copied them from version 1.18.0 of the same file. Allen4names (talk) 17:03, 28 March 2012 (UTC)
 * I have tested this and the installer in version 1.17.3 does not set this variable in "LocalSetting.php". Allen4names (talk) 17:48, 28 March 2012 (UTC)
 * Hmmm... I can remember my post but not this thread. Senior moments. O_o I could swear that is was added to the LocalSettings.php. However, if you just tested it I must be wrong. I guess it is safrer to keep 1.18.0 Thank you for checking and looking into this matter. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 19:13, 28 March 2012 (UTC)

Symptoms of misconfigured $wgServer
There is a certain problem I've seen several times, which can be caused by a misconfiguration of this setting and perhaps by other causes as well. What happens is that the sidebar and logo go away and much of the other formatting goes away too. Here are a couple screenshots to illustrate. Leucosticte (talk) 04:27, 18 September 2012 (UTC)

Discussion of $wgServer on Bugzilla
There's a nice discussion of $wgServer at 40679. --MZMcBride (talk) 03:34, 2 October 2012 (UTC)