nginx.conf 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #user nobody;
  2. worker_processes 2;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. error_log logs/info.log info;
  6. error_log logs/error.log error;
  7. #pid logs/nginx.pid;
  8. events {
  9. worker_connections 1024;
  10. }
  11. http {
  12. include mime.types;
  13. default_type application/octet-stream;
  14. log_format main '$remote_addr - $remote_user [$time_local] "$request" "$http_host" '
  15. '$status $body_bytes_sent "$http_referer" '
  16. '"$http_user_agent" "$http_x_forwarded_for" '
  17. '$upstream_status $upstream_addr '
  18. '$request_time $upstream_response_time'
  19. ;
  20. access_log logs/access.log main;
  21. sendfile on;
  22. #tcp_nopush on;
  23. keepalive_timeout 65;
  24. underscores_in_headers on;
  25. #gzip on;
  26. lua_package_path "$prefix/lua/?.lua;;";
  27. init_worker_by_lua_file 'lua/initialize.lua';
  28. upstream http_cluster {
  29. server 0.0.0.1; # just an invalid address as a place holder
  30. balancer_by_lua_file 'lua/balancer.lua';
  31. }
  32. upstream grpc_cluster {
  33. server 0.0.0.2; # just an invalid address as a place holder
  34. balancer_by_lua_file 'lua/balancer.lua';
  35. }
  36. include vhost/*.conf;
  37. }
  38. stream {
  39. log_format tcp_proxy '$remote_addr [$time_local] '
  40. '$protocol $status $bytes_sent $bytes_received '
  41. '$session_time "$upstream_addr" '
  42. '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
  43. access_log logs/tcp-access.log tcp_proxy;
  44. server {
  45. listen 9128;
  46. proxy_connect_timeout 1s;
  47. proxy_timeout 3s;
  48. proxy_pass 127.0.0.1:3128;
  49. }
  50. }