
user  nginx;
worker_processes  auto;

error_log  stderr notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /dev/stdout  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    keyval_zone zone=zone_one:32k;
    keyval $arg_text $text zone=zone_one;

    include /etc/nginx/conf.d/*.conf;
}

stream {
    keyval_zone zone=zone_one_stream:32k;
    keyval $hostname $text zone=zone_one_stream;
    keyval_zone zone=zone_test_sync:32k timeout=5s sync;
    limit_conn_zone $binary_remote_addr zone=addr_stream:10m;

    limit_conn addr_stream 1;

    upstream stream_test {
        zone stream_test 64k;
    }

    server {
        listen 8081;
        proxy_pass stream_test;
        status_zone stream_test;
        health_check interval=10 fails=3 passes=1;
    }

    resolver 127.0.0.11 valid=5s status_zone=resolver_test;

    server {
        listen 7777;

        zone_sync;
        zone_sync_server nginx-plus-test:7777 resolve;
    }
}
