Redhat 7 install & setup wiki

This article uses opensource software mediawiki as an example, mediawiki reference, will use nginx as web server and MySQL database

Download latest stable version of mediawiki

Meidawiki requires PHP version 7.4.3+, so make sure your PHP environment has above version

# Create a website folder in nginx for your wiki.
sudo mkdir /usr/share/nginx/html/mediawiki/
# Go to mediawiki folder and download latest stable mediawiki
sudo wget
# Unpackage this tar file
tar -xf mediawiki-*.tar.gz
# Move all files to current folder
sudo mv mediawiki-1.37.1/* ./

# Delete mediawiki-1.37.1 folder and downloaded tar.gz file
sudo rm -rf mediawiki-1.37.1

Create MySQL database for mediawiki

CREATE USER 'wikiadmin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiadmin'@'localhost' WITH GRANT OPTION;

Create nginx conf file for wiki site

# Create a conf file under /etc/nginx/conf.d/wiki.your-website.conf
sudo vi /etc/nginx/conf.d/wiki.your-website.conf
# Example configuration
    server {
       server_name wiki.your-website;
       allow your-server-ip;
       deny all;

       root /usr/share/nginx/html/mediawiki;
       index index.php index.html;

       access_log /var/log/nginx/mediawiki_access.log;
       error_log /var/log/nginx/mediawiki_error.log;

       location / {
          # This is cool because no php is touched for static content.
          # include the "?$args" part so non-default permalinks doesn't break when using query string
          try_files $uri $uri/ /index.php?$args;

       location ~ \.php$ {
          #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
          include fastcgi_params;
          fastcgi_intercept_errors on;
          fastcgi_pass php;
          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;

       location = /xmlrpc.php {
          deny all;

       location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
          expires max;
          log_not_found off;


Visit your wiki.your-website to start configuration

Follow the guide to install your mediawiki, you’ll need to get a LocalSettings.php file and put it under root folder of your wiki site.

Leave a Comment