
user  root;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  logs/error.log  info;

#pid        logs/nginx.pid;

stream_zone  buckets=10007 streams=10000;

events {
    worker_connections  1024;
    multi_listen 9000 80;
    multi_listen unix:/tmp/http.sock.80 80;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        location /stream_zone_test/ {
            stream_zone_test;
        }

        location /multiport_test/ {
            inner_proxy unix:/tmp/http.sock.80 /inner_proxy;
            multiport_test;
        }

        location /inner_proxy/ {
            rewrite ^/inner_proxy/(.*):/(.*) /$2 break;
            proxy_pass http://$1:;
        }

        location / {
            broadcast unix:/tmp/http.sock.80 /auth_proxy;
        }

        location /auth_proxy/ {
            rewrite ^/auth_proxy/(.*) /auth break;
            proxy_pass http://$1:;
        }

        location /auth {
        #    return 403;
            echo "auth";
            echo $scheme://$host$uri?$args;
        }
    }
}
