Skip to content

Instantly share code, notes, and snippets.

@hellekin
Created September 1, 2014 03:36
Show Gist options
  • Save hellekin/440d3a8f35253099db28 to your computer and use it in GitHub Desktop.
Save hellekin/440d3a8f35253099db28 to your computer and use it in GitHub Desktop.

# ## wiki.example.org #

server {

listen 80; listen 443 ssl;

server_name wiki.example.org; root /var/lib/mediawiki; index index.php; charset utf8;

access_log /srv/example.org/log/wiki.access.log; error_log /srv/example.org/log/wiki.error.log;

if ($request_method !~ ^(GET|HEAD|POST)$) { return 405; }

location = /favicon.ico { expires +1y; } location = /robots.txt { default_type text/plain; expires +1M; echo “User-Agent: *”; echo “Disallow: /index.php”; echo “Disallow: /Special:Random”; echo “Disallow: /Special:Search”; echo “Disallow: /w/Special:Random”; echo “Disallow: /w/Special:Special”; echo_flush; }

location = /maintenance.html { log_not_found off; }

location / { try_files $uri $uri/ =404; error_page 404 = @mediawiki; }

location @mediawiki { rewrite ^/(.*)$ /index.php?title=$1&$args last; }

location ~ .php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/srv/example.org/run/wiki.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment