

Those extensions may require setting the values of more variables in LocalSettings.php check the documentation of the according extension for further instructions. These lines enable the according extension in the wiki. Within the file, there can also be several lines such as ' require_once "$IP/extensions/ extension.php" ', which point to extensions. Within LocalSettings.php you can add new lines at the end. The default values of many more settings are set in includes/DefaultSettings.php, which should not be edited if the variable you want to change is not already mentioned in your LocalSettings.php, copy the appropriate line from DefaultSettings.php and modify it appropriately in LocalSettings.php. Anyway, in some cases you may need to clear your browser's cache to actually see the changes you made. Your changes will take effect immediately after saving the file again on the server: There is no need to manually "restart" anything. Changing a setting usually means changing the value of a PHP variable.
#Mediawiki configure code#
LocalSettings.php contains PHP code mainly the definition of variables and their values. You should use "ANSI as UTF-8" encoding - that is UTF-8 encoding without byte order mark (BOM). When you edit LocalSettings.php, make sure to save it in the right encoding again. See also Manual:Securing database passwords for a method to move the sensitive parts of LocalSettings.php to a different file in a different directory. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials. For improved security you should narrow permissions down as far as possible.Īdditionally, you can create a MySQL user, who is restricted to only the database used by the wiki and provide this user's credentials in LocalSettings.php. In this case, permissions of 640 should be fine. Sometimes, the webserver user is not the file owner, but they are in the owner's UNIX user group. If this is the same account, who is the owner of the file, then you can set permissions to 600. In order to improve security of your data, you should set UNIX permissions for this file accordingly: The webserver user must have access to this file. This data should never be revealed to the public!ĭue to a security breach somewhere on the server, it might happen that other users are able to view the contents of files. LocalSettings.php usually contains sensitive data such as database logins. (If you are using Vagrant, see also MediaWiki-Vagrant#MediaWiki_settings.) If you do not know where it is, you can enter a command such as find / -iname LocalSettings.php -print in a terminal window to locate it. If this file is not there, the wiki will not work at all-if the wiki does work, the file is there. The file must be located in the folder you installed MediaWiki into, on the same level with folders like includes/and skins/ and files like api.php. Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually. Instead, it is a file in the file system of the server. The LocalSettings.php file is not a wiki page, and you cannot access it with your web browser. The file is usually generated by the web-based MediaWiki installer but you can tweak the parameters, possibly in concert with Apache settings.įor MediaWiki installations configured as a wiki farm, a file named CommonSettings.php may be used. You should take your time to review the settings in this file. The LocalSettings.php file provides basic configuration settings (based on the DefaultSettings.php file) of a MediaWiki installation. They can also be used to repair files previously broken by document editors. These break the PHP runtime of your wiki.
#Mediawiki configure windows 10#
This assumes that you have already obtained an SSL certificate (I generated a self-signed one) which has been placed in /etc/apache2/ssl/apache.pem and /etc/apache2/ssl/apache.key as referenced in the config above.Don't edit LocalSettings.php with document editors like Notepad on Windows 10 Version 1809 or earlier, TextEdit, or other text editors that add byte order marks to files.

SSLCertificateKeyFile /etc/apache2/ssl/apache.keyĬustomLog $/access.log combinedĮnable the default SSL site, if you haven't already (this creates a link from sites-enabled to sites-available) sudo a2ensite default-ssl SSLCertificateFile /etc/apache2/ssl/apache.pem To read something like: # Redirect HTTP to HTTPS Then configure apache2 to redirect all HTTP traffic to HTTPS:Įdit the default SSL configuration (this assumes you are just using the default site): sudo vim /etc/apache2/sites-available/nf This makes the server name "protocol relative" so it works with either HTTP or HTTPS. I've just done this on Ubuntu 14 (for the first time today, so there may be a better way!) by setting $wgServer = "///mediawiki"
