MediaWiki
Installing MediaWiki on a Nginx web server[edit | edit source]
Here is my quick guide to use MediaWiki on a Nginx server using php-fpm.
There are many ways of doing this. I like pretty url's, so this configuration will remove the index.php
from the url. This is great, but it will not redirect links to index.php to the new none index.php links. You also need to configure MediaWiki to use short urls. Also, the below configuration dose assume your using Unix socket connections to php-fpm.
So here we go, inside your http { block, add the following.
/etc/nginx/nginx.conf:
server { listen 80; server_name wiki.example.com; root /var/www/wiki.example.com; include mediawiki.conf; }
/etc/nginx/mediawiki.conf:
# MediaWiki Config location ~ \.htaccess { deny all; } location ~* /sitemaps/ { autoindex on; } # Remove index.php from URI rewrite ^/index.php/(.*) /$1 permanent; location / { if (!-e $request_filename) { rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last; } if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") { expires max; break; } } location ~* \.php$ { if (!-e $request_filename) { return 404; } include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php-fpm.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }
If you only have a single wiki on your server, there's really no reason to create a new mediawiki.conf file, but instead just add it to the server block.
Installing the Math Plugin[edit | edit source]
apt-get -y install ko.tex-extra-hlfont latex-cjk-all latex-cjk-chinese latex-cjk-chinese-arphic-bkai00mp \ latex-cjk-chinese-arphic-bsmi00lp latex-cjk-chinese-arphic-gbsn00lp latex-cjk-chinese-arphic-gkai00mp \ latex-cjk-common latex-cjk-japanese latex-cjk-japanese-wadalab latex-cjk-korean latex-cjk-thai \ latex-cjk-xcjk latex-fonts-thai-tlwg libaprutil1-dbd-sqlite3 swath texlive-xetex thailatex
Next change into your MediaWiki directory and into the Math subdirectory
cd extensions/Math/math
And run make
make
Now you need to make texvccheck
cd extensions/Math/texvccheck/
And run make
make
After the install, you need to set your conf as following:
### Math ### # http://www.mediawiki.org/wiki/Extension:Math require_once( "$IP/extensions/Math/Math.php" );
Math Examples[edit | edit source]
Once your done, you may enter a math formula such as:
<math> \operatorname{erfc}(x) = \frac{2}{\sqrt{\pi}} \int_x^{\infty} e^{-t^2}\,dt = \frac{e^{-x^2}}{x\sqrt{\pi}}\sum_{n=0}^\infty (-1)^n \frac{(2n)!}{n!(2x)^{2n}} </math>
This will produce:
or a more simpler:
<math>{a}^2+{b}^2={c}^2</math>
will produce:
or even pi (π):
<math> \pi = \frac{C}{d}</math>
will produce:
Configuration Changes[edit | edit source]
[edit | edit source]
See: http://www.mediawiki.org/wiki/Manual:Interface/Sidebar
- Go to MediaWiki:Sidebar (http://wiki.example.com/index.php?title=MediaWiki:Sidebar)
- Modify the page and save
Building MediaWiki Sitemap[edit | edit source]
Build a script to be put in your server's crontab.
#!/bin/bash cd /var/www/wiki.mattrude.com/ rm -f sitemap* /usr/bin/php /var/www/wiki.mattrude.com/maintenance/generateSitemap.php --server http://wiki.mattrude.com --urlpath http://wiki.mattrude.com ln sitemap-index-mattrude_com_wiki.xml sitemap.xml
User Namespace[edit | edit source]
ID | Name |
---|---|
0 | Main |
1 | Main Talk |
2 | User |
3 | User Talk |
4 | Project |
5 | Project Talk |
6 | File |
7 | File Talk |
8 | MediaWiki |
9 | MediaWiki Talk |
10 | Template |
11 | Template Talk |
12 | Help |
13 | Help Talk |
14 | Category |
15 | Category Talk |
How to Patch MediaWiki[edit | edit source]
Download the patch file inside your wiki folder.
wget http://download.wikimedia.org/mediawiki/1.9/mediawiki-1.9.3.patch
Then to patch it run.
patch -p0 -i mediawiki-1.9.3.patch
MediaWiki Tips & Tricks[edit | edit source]
To change the way the title is displayed on pages:
{{DISPLAYTITLE:pagetitle}}
so for example to change the name PhpLDAPadmin to phpLDAPadmin add the following.
{{DISPLAYTITLE:phpLDAPadmin}}