A PHP/nginx/ubuntu configuration

I like to make changes that simplify our setup by removing the amount of different technologies we use, to reduce mental and maintenance overhead. We use public-facing nginx proxy servers that point to our internal application servers. On our PHP sites that use Drupal 7 or MediaWiki, these internal application servers were using Apache to serve the PHP code. It's been possible for a while now to use nginx in place of Apache for this, so I've recently made that change for our staging instances, and I'll be activating this for production soon.

For MediaWiki, the application conf looks like this:

server {
    listen   80;
    server_name {{server_name}};
    root /var/www/{{app}};
    index index.php;

    location / {
        try_files $uri $uri/ @rewrite;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;

When making changes like this, it's often best to only change one thing at a time. But in this case I broke that rule by using this as an opportunity to test out using Ubuntu 16.04 / PHP 7, and things just worked without any issues.