# ## 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; }
}