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, upstream)

MediaWiki installation and configuration for Apache 2.4 using PHP-FPM (Debian, upstream)
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 mediawiki.example.org as a virtual host of Apache 2.4 using PHP-FPM.

Installation

Mediawiki can be downloaded from upstream using GNU Wget:

root@computer:~# wget https://releases.wikimedia.org/mediawiki/1.30/mediawiki-1.30.0.tar.gz

The data of the archive file can be extracted using GNU Tar:

root@computer:~# tar --extract --file mediawiki-1.30.0.tar.gz

The archive file can be removed after extraction:

root@computer:~# rm mediawiki-1.30.0.tar.gz

A virtual server root directory is created for MediaWiki:

root@computer:~# mkdir --parents /srv/http/mediawiki.example.org/

Mediawiki is moved to its virtual server root directory:

root@computer:~# mv mediawiki-1.30.0/ /srv/http/mediawiki.example.org/

Configuration

The error and access logs are created:

root@computer:~$ touch /var/log/apache2/mediawiki.example.org.log
root@computer:~$ touch /var/log/apache2/mediawiki.example.org.error.log

A file is created to contain the configuration for the mediawiki.example.org virtual host:

root@computer:~$ touch /etc/apache2/sites-available/mediawiki.example.org.conf

The mediawiki.example.org.conf file contains a virtual host declaration:

<VirtualHost *:80>
	CustomLog /var/log/apache2/mediawiki.example.org.log combined

	<Directory /srv/http/mediawiki.example.org/>
		Require all granted
	</Directory>

	DocumentRoot /srv/http/mediawiki.example.org/

	ErrorLog /var/log/apache2/mediawiki.example.org.error.log

	ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/http/mediawiki.example.org/$1

	ServerName http://mediawiki.example.org:80
</VirtualHost>

Conclusion

Configuration enablement

The configuration is enabled using the provided helper script:

root@computer:~$ a2ensite mediawiki.example.org

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 directory root 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 virtual host root directory of MediaWiki.

Directory ownership and permissions

The virtual server root directory should be protected:

root@computer:~# chown --recursive root:adm /srv/http/mediawiki.example.org/
root@computer:~# chmod --recursive 0775 /srv/http/mediawiki.example.org/

See also

External links

This article has additional content here.