server {
    listen 80;
    server_name _;
    client_max_body_size 20M;
    resolver 127.0.0.11 valid=30s ipv6=off;

    add_header Access-Control-Allow-Origin "*" always;
    add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
    add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;

    if ($request_method = OPTIONS) {
        return 204;
    }

    root /var/www/ProjectKiln;
    index index.php index.html;

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

    location ~ \.php$ {
        try_files $uri =404;

        fastcgi_pass php:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_AUTHORIZATION $http_authorization;
    }

    location ~ /\. {
        deny all;
    }
}
