nginx.conf 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 4096;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log /var/log/nginx/access.log main;
  15. sendfile on;
  16. keepalive_timeout 65;
  17. # include /etc/nginx/conf.d/*.conf;
  18. upstream minio {
  19. server minio1:9000;
  20. server minio2:9000;
  21. server minio3:9000;
  22. server minio4:9000;
  23. }
  24. upstream console {
  25. ip_hash;
  26. server minio1:9001;
  27. server minio2:9001;
  28. server minio3:9001;
  29. server minio4:9001;
  30. }
  31. server {
  32. listen 9000;
  33. listen [::]:9000;
  34. server_name localhost;
  35. # To allow special characters in headers
  36. ignore_invalid_headers off;
  37. # Allow any size file to be uploaded.
  38. # Set to a value such as 1000m; to restrict file size to a specific value
  39. client_max_body_size 0;
  40. # To disable buffering
  41. proxy_buffering off;
  42. proxy_request_buffering off;
  43. location / {
  44. proxy_set_header Host $http_host;
  45. proxy_set_header X-Real-IP $remote_addr;
  46. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  47. proxy_set_header X-Forwarded-Proto $scheme;
  48. proxy_connect_timeout 300;
  49. # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
  50. proxy_http_version 1.1;
  51. proxy_set_header Connection "";
  52. chunked_transfer_encoding off;
  53. proxy_pass http://minio;
  54. }
  55. }
  56. server {
  57. listen 9001;
  58. listen [::]:9001;
  59. server_name localhost;
  60. # To allow special characters in headers
  61. ignore_invalid_headers off;
  62. # Allow any size file to be uploaded.
  63. # Set to a value such as 1000m; to restrict file size to a specific value
  64. client_max_body_size 0;
  65. # To disable buffering
  66. proxy_buffering off;
  67. proxy_request_buffering off;
  68. location / {
  69. proxy_set_header Host $http_host;
  70. proxy_set_header X-Real-IP $remote_addr;
  71. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  72. proxy_set_header X-Forwarded-Proto $scheme;
  73. proxy_set_header X-NginX-Proxy true;
  74. # This is necessary to pass the correct IP to be hashed
  75. real_ip_header X-Real-IP;
  76. proxy_connect_timeout 300;
  77. # To support websocket
  78. proxy_http_version 1.1;
  79. proxy_set_header Upgrade $http_upgrade;
  80. proxy_set_header Connection "upgrade";
  81. chunked_transfer_encoding off;
  82. proxy_pass http://console;
  83. }
  84. }
  85. }