Mediawiki
The Wikimedia foundation Wiki.
Setup
MySQL
CREATE DATABASE mediawiki CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci; CREATE USER 'mediawiki'@'X.X.X.X' IDENTIFIED BY 'mediawiki'; GRANT ALL ON mediawiki.* TO 'mediawiki'@'X.X.X.X' WITH GRANT OPTION; FLUSH PRIVILEGES;
NB It's important to correctly quote the username and address as shown above.
NGINX
Adapt this site configuration for your needs and update LocalSetttings.php later in this guide for URL rewriting.
$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1"; $wgUsePathInfo = true;
Install
PHP composer
apt install composer composer -V Composer version 2.5.5 2023-03-21 11:50:05
PHP8 APCu
apt install php-pear php-dev pecl install APCu echo "extension=apcu.so" >> /etc/php/8.2/mods-available/local.ini ln -sf /etc/php/8.2/mods-available/local.ini /etc/php/8.2/fpm/conf.d/10-local.ini
Wiki
mkdir -p /var/www/htdocs/www.example.com cd /var/www/htdocs/www.example.com wget "https://releases.wikimedia.org/mediawiki/1.43/mediawiki-1.43.0.zip" unzip mediawiki-1.43.0.zip mv mediawiki-1.43.0 w chown -R www-data:www-data w
Settings
Visit the wiki site and follow the installation procedure which will conclude with a download of the LocalSettings.php file.
It's recommended to choose “en - English” as the installation language.
NB If the site crashes then it may be due to this bug.
cd ./mediawiki-1.45.1/vendor/wikimedia/parsoid/ wget https://gerrit.wikimedia.org/r/changes/mediawiki%2Fservices%2Fparsoid~1220366/revisions/4/patch?zip unzip 2db95b1.diff.zip patch -p1 < 2db95b1.diff cd ../../../ composer update -a
Edit the settings file and upload to the server and installation is complete.
#$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
wfLoadExtension('Nuke');
Language
If you didn't choose “en - English” as the installation language you can change it after installation.
For example, during installation the site language may have been set to “en-gb” (or something else) and it's preferable to use the Mediawiki default language of “en”.
Add the following to LocalSettings.php
$wgLanguageCode = "en";
Now reset the language to “en”.
echo 'MediaWiki\MediaWikiServices::getInstance()->getMessageCache()->clear()' | php maintenance/run.php eval php maintenance/run.php userOptions.php language --old en-gb --new en
To disable language selection (from “en”) in user preferences, add the following to LocalSettings.php
$wgHiddenPrefs[] = 'language';
Languages
cd extensions git clone https://github.com/wikimedia/mediawiki-extensions-UniversalLanguageSelector UniversalLanguageSelector chown -R www-data:www-data UniversalLanguageSelector
wfLoadExtension('UniversalLanguageSelector');
Bot
Special pages → Account management → Bot passwords.

