Mediawiki Setup
From NCOT Wiki
Jump to navigationJump to search
Install MediaWiki Properly
Extract MediaWiki into /var/www/html/w
Location | Contents |
---|---|
/var/www/html/w/ | MediaWiki files extracted to here |
/wiki/ | Public path for index.php (rewritten URLs go here). Not a real directory. |
Set Directory Permissions
sudo chown -R www-data:www-data /var/www/html/w
Update LocalSettings.php
$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1"; $wgUsePathInfo = true;
Configure NGINX
- /robots.txt still works (for search engines)
- /favicon.ico is unaffected (browsers expect it)
- ACME challenges (Let’s Encrypt) under /.well-known/ won't break
- Only GET / gets redirected to /wiki/
server { listen 80; server_name wiki.ncot.uk; root /var/www/html; # Let Nginx serve static files directly location = /robots.txt { } location = /favicon.ico { } location ^~ /.well-known/ { } location = / { return 301 /wiki/; } location = /wiki { return 301 /wiki/; } location /wiki/ { try_files $uri $uri/ /w/index.php; } location /w/ { root /var/www/html; index index.php; } location ~ ^/w/(.+\.php)$ { root /var/www/html; include fastcgi_params; fastcgi_pass unix:/run/php/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }