Open main menu

Humanoid Robots Wiki β

Setting Up MediaWiki on AWS

Revision as of 18:27, 21 May 2024 by Ben (talk | contribs) (Extras)

This document contains a walk-through of how to set up MediaWiki on AWS. In total, this process should take about 30 minutes.

Contents

Getting Started

  1. Use this service to install MediaWiki to an EC2 instance
  2. After installing, SSH into the instance. The MediaWiki root files live in /var/www/html, and Apache configuration files live in /etc/apache2

Set up A Record

In your website DNS, create an A record which points from your desired URL to the IP address of the newly-created EC2 instance. For example:

  • Host name: @ (for the main domains) or wiki (for subdomains)
  • Type: A
  • Data: 127.0.0.1 (use the IP address of the EC2 instance)

Installing OpenSSL

Roughly follow these instructions to install OpenSSL using LetsEncrypt

  1. Install certbot
sudo apt install certbot python3-certbot-apache
  1. Run certbot (you can just select "No redirect"
sudo certbot --apache
  1. Verify certbot
sudo systemctl status certbot.timer

Update Page URLs

To get MediaWiki to display pages using the /w/Some_Page URL, modify LocalSettings.php. Replace the line where it says $wgScriptPage = ""; with the following:

$wgScriptPath = "";
$wgArticlePath = "/w/$1";
$wgUsePathInfo = true;

Next, in /etc/apache2/apache2.conf, add the following section:

<Directory /var/www/html>
        AllowOverride all
</Directory>

Create a new .htaccess in /var/www/html with the following contents:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^w/(.*)$ index.php/$1 [PT,L,QSA]

Finally, reload Apache2:

sudo service apache2 reload

Extras

Here are some notes about some extra features you can add on top of MediaWiki.

Storing images in S3 with Cloudfront

You can use the AWS MediaWiki Extension to allow users to upload images and files, store them in S3, and serve them through CloudFront.

This process is somewhat involved. I may write notes about how to do this well in the future.

Enabling LaTeX

  1. Install the Math extension to the extensions directory
  2. Change to the origin/REL1_31 branch
  3. Run the update script: sudo php maintenance/update.php