There are no notfications.

This article was last reviewed for Debian 9 (Stretch).

MediaWiki installation and configuration for Apache 2.4 using PHP-FPM (Debian, repository)

MediaWiki installation and configuration for Apache 2.4 using PHP-FPM (Debian, repository)
Author: Stefán Örvar Sigmundsson
Initial publication:
Last updated:
Written in: English (United Kingdom)

MediaWiki is a free and open-source wiki software and the world's most popular as such. This article will demonstrate how to install and configure Mediawiki on Debian or its derivatives such as Ubuntu and Linux Mint. The wiki will be configured for the domain as a virtual host of Apache 2.4 using PHP-FPM.


MediaWiki can be installed from the official Debian repository using APT:

root@computer:~# apt --assume-yes install mediawiki


The error and access logs are created:

root@computer:~$ touch /var/log/apache2/
root@computer:~$ touch /var/log/apache2/

A file is created to contain the configuration for the virtual host:

root@computer:~$ touch /etc/apache2/sites-available/

The file contains a virtual host declaration:

<VirtualHost *:80>
	CustomLog /var/log/apache2/ combined

	<Directory /usr/share/mediawiki/>
		Require all granted

	DocumentRoot /usr/share/mediawiki/

	ErrorLog /var/log/apache2/

	ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1



Configuration enablement

The configuration is enabled using the provided helper script:

root@computer:~$ a2ensite

Server reinitiation

Apache is restarted when the configuration is done:

root@computer:~$ systemctl reload apache2.service

Wiki database setup

The database of the wiki can be set up by following the steps presented after browsing to the root directory of the virtual host. At the end of the setup a file will be downloaded called LocalSettings.php that contains the configuration of the wiki as chosen during the wiki setup. The file must be placed in the /etc/mediawiki/ directory.

Directory ownership and permissions

The configuration directory should be protected:

root@computer:~# chown --recursive root:adm /etc/mediawiki/
root@computer:~# chmod --recursive 0775 /etc/mediawiki/

See also

External links

This article has additional content here.