There are no notfications.

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

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

MediaWiki installation and configuration for Nginx 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 mediawiki.example.org as a virtual server of Nginx using PHP-FPM.

Installation

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

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

Configuration

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

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

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

server
{
	access_log /var/log/nginx/mediawiki.example.org.log;

	error_log /var/log/nginx/mediawiki.example.org.error.log;

	listen 80;

	location ~ [^/]\.php(/|$)
	{
		fastcgi_pass unix:/run/php/php7.0-fpm.socket;

		include /etc/nginx/conf.d/http_fastcgi.conf;
	}

	root /usr/share/mediawiki/;

	server_name mediawiki.example.org;
}

Conclusion

Configuration enablement

The virtual server is enabled by creating a symbolic link to its configuration file in the sites-enabled directory:

root@computer:~$ ln --symbolic /etc/nginx/sites-available/mediawiki.example.org.conf /etc/nginx/sites-enabled/mediawiki.example.org.conf

Server reinitiation

Nginx is restarted when the configuration is done:

root@computer:~$ systemctl reload nginx.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 server. 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.