server {
    listen 80;
    server_name localhost;
    root /var/www/site/htdocs;
    #    error_log  /var/log/nginx/error_log  warn;


    index index.php;

    charset utf-8;

    location = /favicon.ico {
        access_log off;
        log_not_found off;
        rewrite ^/favicon.ico$ https://shared.app.uib.no/img/uib-favicon.ico permanent;
    }
    location = /robots.txt {
        access_log off;
        log_not_found off;
        return 200 "User-agent: *\nDisallow: /";
    }

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/www.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ ^/(fpm-status|ping)$ {
        if ( $args ~ 'full' ) {
            #Prevent information leaks
            return 403;
        }
        fastcgi_pass unix:/var/run/php-fpm/www.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
        #Add small cache to limit abuse in case there is a varnish cache.
        expires 10s;
    }


    location ~ /\.(?!well-known).* {
        deny all;
    }
}