server { listen 80; server_name {server_name}; root /var/www/vhosts/mediawiki; location / { index index.php index.html index.htm; try_files $uri $uri/ @rewrite; } location @rewrite { internal; rewrite ^/(.*)$ /index.php?title=$1&$args; } location ~* ^/images/.*.(html|htm|shtml|php)$ { types { } default_type text/plain; } location ~ \.php$ { fastcgi_pass phpfpm; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ \.php5$ { fastcgi_pass phpfpm; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }