Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Created July 3, 2014 09:36
Show Gist options
  • Select an option

  • Save shmaltorhbooks/1182ed08e3a51d3c2702 to your computer and use it in GitHub Desktop.

Select an option

Save shmaltorhbooks/1182ed08e3a51d3c2702 to your computer and use it in GitHub Desktop.
Nginx config for MediaWiki
server {
listen 80;
server_name mediawiki.com;
root /var/www/mediawiki.com;
client_max_body_size 5m;
client_body_timeout 60;
index index.php;
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 127.0.0.1:9013;
}
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.com/local;
autoindex on;
}
error_log /var/log/nginx/mediawiki.com.error.log;
access_log /var/log/nginx/mediawiki.com.access.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment