Configuring and Using MediaWiki with NGINX

NGINX Setup for MediaWiki

MediaWiki, most recognized by its use with Wikipedia, is the most popular open source wiki platform available. With features heavily focused on the ease of editing and sharing content, MediaWiki makes a great system to store information you want to continually edit:



Table of contents[Show]

This example assumes you already have a working instance of MediaWiki or are familiar with the installation process. For those unfamiliar with the process, it's available online at https://www.mediawiki.org/wiki/Manual:Installation_guide.

The basic NGINX configuration for MediaWiki is very similar to many other PHP platforms. It has a flat directory structure which easily runs with basic system resources.

Here's the configuration:

server { 
    listen       80; 
    server_name  mediawiki.nginxcookbook.com; 
 
    access_log  /var/log/nginx/mediawiki.access.log  combined; 
    index index.php; 
 
    root   /var/www/html/; 
 
    location / { 
        try_files $uri $uri/ /index.php?$args; 
    } 
 
    location ~ \.php$ { 
        fastcgi_pass unix:/var/run/php7.0-fpm.sock; 
        fastcgi_index index.php; 
        fastcgi_param SCRIPT_FILENAME 
$document_root$fastcgi_script_name; include fastcgi_params; } }

The default installation doesn't use any rewrite rules, which means you'll get URLs such as index.php?title=Main_Page instead of the neater (and more readable) /wiki/Main_Page. To enable this, we need to edit the LocalSettings.php file and add the following lines:

$wgArticlePath = "/wiki/$1"; 
$wgUsePathInfo = TRUE; 

This allows the URLs to be rewritten in a much neater format.

NGINX recipe: https://www.nginx.com/resources/wiki/start/topics/recipes/mediawiki/

Вас заинтересует / Intresting for you:

Configuring and Using Joomla w...
Configuring and Using Joomla w... 776 views Гвен Sun, 20 Mar 2022, 07:00:05
Configuring and Using Magento ...
Configuring and Using Magento ... 815 views Гвен Sun, 20 Mar 2022, 07:00:30
 Setup and configuring Django ...
Setup and configuring Django ... 807 views Гвен Wed, 06 Apr 2022, 17:58:18
Configuring NGINX for WordPres...
Configuring NGINX for WordPres... 668 views Гвен Sun, 20 Mar 2022, 07:01:55
Comments (0)
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations