error_log "{{LOG_DIR}}/nginx_error.log";
pid "{{LOG_DIR}}/nginx.pid";
worker_processes 1;
events {
    worker_connections 1024;
}
http {
    include "{{CONF_DIR}}/mime.types";
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    server {
        listen {{PORT}};
        server_name localhost;
        root "{{ROOT}}";
        index index.php index.html index.htm;

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

        {{PROJECTS}}

        location /phpmyadmin {
            alias "{{PHPMYADMIN_DIR}}";
            index index.php;
            location ~ ^/phpmyadmin/(.+\.php)$ {
                alias "{{PHPMYADMIN_DIR}}/$1";
                fastcgi_pass 127.0.0.1:{{PHP_PORT}};
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                include "{{CONF_DIR}}/fastcgi_params";
            }
        }

        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:{{PHP_PORT}};
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include "{{CONF_DIR}}/fastcgi_params";
        }
    }
}
