Setting up this MediaWiki
Setting up a cloud ubuntu box
I setup an Ubuntu box on the cloud (Vultr).
ufw allow 80
so firewall allows HTTP traffic.
Install mediawiki
I followed this guide:
https://www.atlantic.net/vps-hosting/how-to-install-mediawiki-ubuntu-20-04/
At this point http://108.61.173.103 shows the default "Apache is running" /var/www/html/index.html and http://108.61.173.103/mediawiki shows the wiki.
Purchase a domain and point it to the box IP
I purchased a domain (ient.ai) and created an A-record that sends sap
to 108.61.173.103.
It took a few hours for the change to make it to the DNS servers.
Now sap.ient.ai
in Chrome directs to the /var/www/html/index.html
Redirect index.html in the Apache webroot to the wiki
Now I replace the index.html with:
<html>
<head>
<meta http-equiv="refresh" content="0;url=mediawiki/index.php" />
</head>
<body>
</body>
</html>
Now sap.ient.ai
in Chrome directs to http://108.61.173.103/mediawiki/index.php/Main_Page & shows the wiki.
At this point I played with changing the webroot in /etc/apache2/sites-available/000-default.conf to DocumentRoot /var/www/html/mediawiki
but decided I'd rather reserve the option to have a website/landing-page and not auto-direct to the wiki, so I reverted it.
Remember to systemctl restart apache2
every time you tweak Apache.
Tidy URL
Now to tidy that URL.
In /var/www/html/mediawiki/LocalSettings.php
:
## The protocol and server name to use in fully-qualified URLs
# $wgServer = "http://108.61.173.103";
$wgServer = "http://sap.ient.ai"; # pi
Now URL shows as http://sap.ient.ai/mediawiki/index.php/Main_Page
Challenge is to get http://sap.ient.ai/wiki/Main_Page
-
a2enmod rewrite
(and restart Apache). This enables therewrite
module (rewriting paths, I guess) -
Create '/var/www/html/.htaccess':
root@MediaWiki:/var/www/html# cat .htaccess
RewriteEngine On
# main rewrite rule
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/mediawiki/index.php [L]
- Allow .htaccess files to be used in webroot (and subfolders):
In/etc/apache2/apache2.conf
:
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# pi: ^ None -> All (x3)
- In
/var/www/html/mediawiki/LocalSettings.php
:$wgArticlePath = "/wiki/$1";
Now sap.ient.ai
in Chrome loads the wiki main page, and URL bar shows http://sap.ient.ai/wiki/Main_Page
Enable Markdown
https://www.mediawiki.org/wiki/Extension:WikiMarkdown#Installation
NOTE: I had to create the composer.local.json
NOTE: For the downloads:
cd extensions
git clone https://github.com/BenjaminHoegh/ParsedownExtended
git clone https://github.com/kuenzign/WikiMarkdown/