FAQ

Page Discussion Edit History

MediaWiki

Here's the basic configuration used for the Nginx wiki.

server {
        server_name wiki.nginx.org;
        root /var/www/mediawiki;
 
        client_max_body_size 5m;
        client_body_timeout 60;
 
        location / {
                try_files $uri $uri/ @rewrite;
        }
 
        location @rewrite {
                rewrite ^/(.*)$ /index.php?title=$1&$args;
        }
 
        location ^~ /maintenance/ {
                return 403;
        }
 
        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_pass unix:/tmp/phpfpm.sock;
        }
 
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                try_files $uri /index.php;
                expires max;
                log_not_found off;
        }
 
        location = /_.gif {
                expires max;
                empty_gif;
        }
 
        location ^~ /cache/ {
                deny all;
        }
 
        location /dumps {
                root /var/www/mediawiki/local;
                autoindex on;
        }
}

NOTE! In order for this configuration to work, you will need to set "$wgUsePathInfo = TRUE;" in your LocalSettings.php file.