Ubuntu MediaWiki
From charlesreid1
Contents
File Uploading
To upload files, allowed extensions must be specified in LocalSettings.php
, and permission must be given for the web server (i.e., MediaWiki) to create arbitrary directories to store uploaded files.
Step 1: Modify LocalSettings.php
Add the following lines to LocalSettings.php to allow uploads of specific extensions:
$wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','mpp','pdf','ppt','tiff','bmp','docx', 'xlsx', 'pptx','ps','odt','ods','odp','odg');
or this, to allow uploads of any extensions:
$wgStrictFileExtensions = false;
Step 2: Give Web Server Permissions
Uploaded files go to /www/w/images
, so give the webserver (user/group www-data using Ubuntu's defaults) read/write/execute access to images:
sudo chown www-data:www-data images/
and permissions should be 755 rwxr-xr-x
:
drwxr-xr-x 5 www-data www-data images/
URL Rewriting
See this page for details: http://www.mediawiki.org/wiki/Manual:Short_URL/Apache
Getting urls like ethane.siluria.com/wiki/PageName
working requires several steps:
Step 1: Modify LocalSettings.php
Near the top of LocalSettings.php, the variable $wgScriptPath
is defined. Redefine it, along with the $wgArticlePath
and $wgUsePathInfo
variables:
############################################### # $wgScriptPath = "/w"; $wgArticlePath="/wiki/$1"; $wgUsePathInfo = true; # ###############################################
which will properly reformat requests from /wiki/$1
to MediaWiki.
Step 2: Modify Apache Configuration File
Modify the Apache configuration file for a wiki VirtualHost as follows:
Alias /wiki /www/w/index.php Alias /w /www/w <Directory "/www/w"> # Enable the rewrite engine RewriteEngine On # Short url for wiki pages RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L] Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>