Difference between revisions of "MediaWiki"
(cron) |
(Localisation cache) |
||
Line 54: | Line 54: | ||
== Speedup == | == Speedup == | ||
By default the mediawiki installation is pretty slow. | By default the mediawiki installation is pretty slow. | ||
+ | |||
+ | === Localisation cache === | ||
+ | Uncomment the line about <code>$wgCacheDirectory</code> in <code>/var/www/mediawiki*/LocalSettings.php.</code><syntaxhighlight lang="php"> | ||
+ | ## Set $wgCacheDirectory to a writable directory on the web server | ||
+ | ## to make your wiki go slightly faster. The directory should not | ||
+ | ## be publically accessible from the web. | ||
+ | $wgCacheDirectory = "$IP/cache"; | ||
+ | </syntaxhighlight> | ||
=== Enable CronJob === | === Enable CronJob === | ||
Line 62: | Line 70: | ||
</syntaxhighlight>Then add the following line in <code>/etc/crontab</code><syntaxhighlight lang="text"> | </syntaxhighlight>Then add the following line in <code>/etc/crontab</code><syntaxhighlight lang="text"> | ||
0 0 * * * www-data /usr/bin/php /var/www/mediawiki-1.26.2/maintenance/runJobs.php > /var/log/mediawiki-runJobs.log | 0 0 * * * www-data /usr/bin/php /var/www/mediawiki-1.26.2/maintenance/runJobs.php > /var/log/mediawiki-runJobs.log | ||
− | </syntaxhighlight>Finally you can disable jobs running on user visits<syntaxhighlight lang="php"> | + | </syntaxhighlight>Finally you can disable jobs running on user visits in <code>/var/www/mediawiki*/LocalSettings.php</code><syntaxhighlight lang="php"> |
# Jobs are run by the cronjob. No need to run them on use visits | # Jobs are run by the cronjob. No need to run them on use visits | ||
# https://www.mediawiki.org/wiki/Manual:$wgJobRunRate | # https://www.mediawiki.org/wiki/Manual:$wgJobRunRate | ||
$wgJobRunRate = 0; | $wgJobRunRate = 0; | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 15:00, 2 January 2016
Warning: | This page is a work in progress and is not completed. Important informations might be missing or wrong. |
Warning: | These instructions were only tested on Debian. It will probably work for other Linux distributions, but you might need to adapt the provided instructions. |
Install Mediawiki
Warning: | Debian packages are currently unmaintained and outdated. This guide will install mediawiki from source. For your security, don't forget to follow upstream releases and update your installation. |
Prerequisite
DNS
This guide assume that you are using a dedicated subdomain for your wiki like https://wiki.example.com. Don't forget to point that domain to your webserver.
Database
You will need a database server store all dynamic data (users, articles…). You can check the MariaDB installation guide.
Nginx
In this guide, we will use Nginx as a web server. Please check the Nginx installation guide.
Get source
# cd /var/www
# curl https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz | tar xz
# chown -R www-data: mediawiki*
Configure Nginx
create certificate
update nginx config
/mw-config
chown root:www-data /etc/mediawiki/LocalSettings.php
chmod 640 /etc/mediawiki/LocalSettings.php
Install Extensions
ParserFunctions
This extension is bundled by default with mediawiki. You just need to activate it.
Add the line wfLoadExtension( 'ParserFunctions' );
to the file /var/www/mediawiki*/LocalSettings.php
SyntaxHighlight
This extension is bundled by default with mediawiki. You just need to activate it.
Add the line wfLoadExtension( 'SyntaxHighlight_GeSHi' );
to the file /var/www/mediawiki*/LocalSettings.php
TemplateData
Allows you to describe your templates using structured data for a better experience with the VisualEditor.
https://www.mediawiki.org/wiki/Extension:TemplateData
VisualEditor
Speedup
By default the mediawiki installation is pretty slow.
Localisation cache
Uncomment the line about $wgCacheDirectory
in /var/www/mediawiki*/LocalSettings.php.
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
$wgCacheDirectory = "$IP/cache";
Enable CronJob
First create the log file
# touch /var/log/mediawiki-runJobs.log
# chown www-data:adm /var/log/mediawiki-runJobs.log
# chmod 640 /var/log/mediawiki-runJobs.log
Then add the following line in /etc/crontab
0 0 * * * www-data /usr/bin/php /var/www/mediawiki-1.26.2/maintenance/runJobs.php > /var/log/mediawiki-runJobs.log
Finally you can disable jobs running on user visits in /var/www/mediawiki*/LocalSettings.php
# Jobs are run by the cronjob. No need to run them on use visits
# https://www.mediawiki.org/wiki/Manual:$wgJobRunRate
$wgJobRunRate = 0;