#user nobody; worker_processes 2; #error_log logs/error.log; #error_log logs/error.log notice; error_log logs/info.log info; error_log logs/error.log error; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" "$http_host" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$upstream_status $upstream_addr ' '$request_time $upstream_response_time' ; access_log logs/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; underscores_in_headers on; #gzip on; lua_package_path "$prefix/lua/?.lua;;"; init_worker_by_lua_file 'lua/initialize.lua'; upstream http_cluster { server 0.0.0.1; # just an invalid address as a place holder balancer_by_lua_file 'lua/balancer.lua'; } upstream grpc_cluster { server 0.0.0.2; # just an invalid address as a place holder balancer_by_lua_file 'lua/balancer.lua'; } include vhost/*.conf; } stream { log_format tcp_proxy '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; access_log logs/tcp-access.log tcp_proxy; server { listen 9128; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass 127.0.0.1:3128; } }