Difference between revisions of "MediaWiki"

From ArchWiki
Jump to: navigation, search
(Nginx: ic template instead of bold)
Line 19: Line 19:
  
 
== Nginx ==
 
== Nginx ==
To get MediaWiki working with Nginx, create the following file at '''/etc/nginx/mediawiki.conf''':
+
To get MediaWiki working with Nginx, create the following file at {{ic|/etc/nginx/mediawiki.conf}}:
  
 
  location / {
 
  location / {
Line 44: Line 44:
 
  }
 
  }
  
Ensure that '''php-fpm''' is installed, and in your '''/etc/nginx/nginx.conf''' file, ensure that you have an {{ic|upstream}} directive named '''php''', similar to this one:
+
Ensure that {{ic|php-fpm}} is installed, and in your {{ic|/etc/nginx/nginx.conf}} file, ensure that you have an {{ic|upstream}} directive named {{ic|php}}, similar to this one:
  
 
  upstream php {
 
  upstream php {
Line 50: Line 50:
 
  }
 
  }
  
Include a server directive, similar to this, in your '''/etc/nginx/nginx.conf''' file:
+
Include a server directive, similar to this, in your {{ic|/etc/nginx/nginx.conf}} file:
  
 
  server {
 
  server {
Line 60: Line 60:
 
  }
 
  }
  
Finally, ensure that the '''open_basedir''' directive in '''/etc/php/php.ini''' includes '''/usr/share/webapps''' and '''/etc/webapps''', or you might get "File not found" or "No input file specified" errors.
+
Finally, ensure that the {{ic|open_basedir}} directive in {{ic|/etc/php/php.ini}} includes {{ic|/usr/share/webapps}} and {{ic|/etc/webapps}}, or you might get "File not found" or "No input file specified" errors.
  
 
== Tips ==
 
== Tips ==

Revision as of 18:20, 4 July 2012

Note: If you are using xampp, there are different steps you need to take after installing. More info here

Installation

Install php-apache, php-intl, imagemagick, mysql and mediawiki, all available from the official repositories.

Instead of imagemagick you can install php-gd. Also instead of mysql you can install sqlite3 or postgresql.

Create /etc/webapps/mediawiki/httpd-mediawiki.conf from the provided example.

Add following lines to /etc/httpd/conf/httpd.conf

LoadModule php5_module modules/libphp5.so
Include conf/extra/php5_module.conf
Include /etc/webapps/mediawiki/httpd-mediawiki.conf

Adjust permissions in /usr/share/webapps/mediawiki/.htaccess

Restart apache with

sudo /etc/rc.d/httpd restart

Nginx

To get MediaWiki working with Nginx, create the following file at /etc/nginx/mediawiki.conf:

location / {
  index index.php;
  try_files $uri @mediawiki;
}
location @mediawiki {
  rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1$2 last;
}
location ~ \.php?$ {
  include fastcgi.conf;
  fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  try_files $uri /index.php;
  expires max;
  log_not_found off;
}
location ^~ /maintenance/ {
  return 403;
}
location ^~ /cache/ {
  deny all;
}

Ensure that php-fpm is installed, and in your /etc/nginx/nginx.conf file, ensure that you have an upstream directive named php, similar to this one:

upstream php {
  server unix:/var/run/php-fpm/php-fpm.sock;
}

Include a server directive, similar to this, in your /etc/nginx/nginx.conf file:

server {
  listen 80;
  server_name mediawiki;
  root /usr/share/webapps/mediawiki;
  index index.php;
  include mediawiki.conf
}

Finally, ensure that the open_basedir directive in /etc/php/php.ini includes /usr/share/webapps and /etc/webapps, or you might get "File not found" or "No input file specified" errors.

Tips

Mathematics (texvc)

Usually installing texvc package and enabling it in config are enough:

 $wgUseTeX = true;

If you get problems, try to increase limits for shell commands:

 $wgMaxShellMemory = 8000000;
 $wgMaxShellFileSize = 1000000;
 $wgMaxShellTime = 300;

Unicode

Check that php, apache and mysql uses UTF-8. Otherwise you may face strange bugs because of encoding mismatch.