github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/docs/orchestration/docker-compose/nginx.conf (about)

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