user www-data;
worker_processes  auto;
error_log stderr error;
#worker_rlimit_nofile 100000;
timer_resolution 1s;
daemon off;
pcre_jit on;

events {
    worker_connections 100000;
	multi_accept off;	 
}

http {
    #include       /etc/nginx/mime.types;
    access_log off;
    server_tokens off;

    sendfile off;
    tcp_nopush off;
    tcp_nodelay on;
    keepalive_timeout 65s;
    keepalive_disable none;
    keepalive_requests 100000;

    php_ini_path /deploy/conf/php.ini;

    init_worker_by_php '
        require "app-async.php";
    ';

    server {
        listen       8080 default_server reuseport;

        root /;
        index  index.html;

        php_keepalive 256;

        location = /fortunes {
	        content_by_php '
                yield from fortune();
            ';
        }

        location = /db {
            content_by_php '
                yield from db();
            ';
        }

        location /query {
	        content_by_php '
                yield from query();
            ';
        }

        location /update {
            content_by_php '
                yield from update();
            ';
        }

    }
}
