Documentation

Mediawiki Nginx Config

A
Adam Birds
Published 10 August 20261 min read1 views
upstream examplecombackend {
server unix:/var/run/php-fcgi-examplecom.sock;
}

server {
listen 80;
server_name example.com;
root /var/www/vhosts/example.com/htdocs;
index index.php;

access_log /var/www/vhosts/example.com/wiki-access.log;
error_log /var/www/vhosts/example.com/wiki-error.log warn;

location / {
try_files $uri $uri/ @handler;
index index.php index.html;
}

#   location /app/                  { deny all; }
#   location /includes/             { deny all; }
#   location /lib/                  { deny all; }
#   location /media/downloadable/   { deny all; }
#   location /pkginfo/              { deny all; }
#   location /report/config.xml/    { deny all; }
#   location /images/               { deny all; }
#   location /var/                  { deny all; }
#
#   location /download/             { allow 46.37.189.40; deny all; }

location /. {
return 404;
}

location @handler {
rewrite ^/(.*)$ /index.php;
}

#   location ~ \.zip$ {
#           deny all;
#   }

location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_pass examplecombackend;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include        fastcgi_params;
}

#   location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
#           expires max;
#           log_not_found off;
#   }

}
Last updated: 10 August 2026v1