user www-data;
worker_processes auto;
error_log stderr error;
worker_rlimit_nofile 200000;

events {
    worker_connections  16384;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    access_log off;
    server_tokens off;
    sendfile on;
    keepalive_timeout  65;

    upstream fastcgi_backend {
        server unix:/var/run/php/php7.2-fpm.sock;
        keepalive 50;
    }

    server {
        listen 8080;
        server_name localhost;

        root /yii2/app;
        index index.php;

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

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_pass fastcgi_backend;
            fastcgi_keep_conn on;
            set $fsn /index.php;
            if (-f $document_root$fastcgi_script_name){
                set $fsn $fastcgi_script_name;
            }
            fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;
            fastcgi_param  PATH_INFO        $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
            include /etc/nginx/fastcgi_params;
        }
    }
}