MinIO 集成 Nginx 代理

专用DNS

为 MinIO 服务创建或配置专用 DNS 名称。

对于 MinIO Server S3 API,将请求代理到该域的根目录。对于 MinIO 控制台 Web GUI,将请求代理到/minio子路径。

例如,给定主机名 minio.example.net

https://minio.example.net 代理向 root 请求监听 https://minio.local:9000.

代理请求到 https://minio.example.net/minioMinIO 控制台的子路径侦听 https://minio.local:9001。

以下位置块提供了在您的独特环境中进一步自定义的模板:

upstream minio {
   least_conn;
   server minio-01.internal-domain.com;
   server minio-02.internal-domain.com;
   server minio-03.internal-domain.com;
   server minio-04.internal-domain.com;
}

server {
   listen       80;
   listen  [::]:80;
   server_name  minio.example.net;

   # Allow special characters in headers
   ignore_invalid_headers off;
   # Allow any size file to be uploaded.
   # Set to a value such as 1000m; to restrict file size to a specific value
   client_max_body_size 0;
   # Disable buffering
   proxy_buffering off;
   proxy_request_buffering off;

   location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_connect_timeout 300;
      # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      chunked_transfer_encoding off;

      proxy_pass https://minio:9000/; # This uses the upstream directive definition to load balance
   }

   location /minio {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-NginX-Proxy true;

      # This is necessary to pass the correct IP to be hashed
      real_ip_header X-Real-IP;

      proxy_connect_timeout 300;

      # To support websockets in MinIO versions released after January 2023
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";

      chunked_transfer_encoding off;

      proxy_pass https://minio:9001/; # This uses the upstream directive definition to load balance and assumes a static Console port of 9001
   }
}

S3 API 签名计算算法不支持example.net/s3/在子路径(例如或)上托管 MinIO Server API 或控制台 GUI 的代理方案example.net/console/。

子域名

为 MinIO Server S3 API 和 MinIO Console Web GUI 创建或配置单独的、唯一的子域。

例如,给定的根域 example.net

代理请求到minio.example.net MinIO Server 监听的子域 https://minio.local:9000

将子域的请求代理 console.example.net 到监听的 MinIO 控制台 https://minio.local:9001

以下位置块提供了在您的独特环境中进一步自定义的模板:

upstream minio {
   least_conn;
   server minio-01.internal-domain.com;
   server minio-02.internal-domain.com;
   server minio-03.internal-domain.com;
   server minio-04.internal-domain.com;
}

server {
   listen       80;
   listen  [::]:80;
   server_name  minio.example.net;

   # Allow special characters in headers
   ignore_invalid_headers off;
   # Allow any size file to be uploaded.
   # Set to a value such as 1000m; to restrict file size to a specific value
   client_max_body_size 0;
   # Disable buffering
   proxy_buffering off;
   proxy_request_buffering off;

   location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_connect_timeout 300;
      # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      chunked_transfer_encoding off;

      proxy_pass http://minio:9000/; # This uses the upstream directive definition to load balance
   }
}

server {

   listen       80;
   listen  [::]:80;
   server_name  console.example.net;

   # Allow special characters in headers
   ignore_invalid_headers off;
   # Allow any size file to be uploaded.
   # Set to a value such as 1000m; to restrict file size to a specific value
   client_max_body_size 0;
   # Disable buffering
   proxy_buffering off;
   proxy_request_buffering off;

   location / {
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-NginX-Proxy true;

      # This is necessary to pass the correct IP to be hashed
      real_ip_header X-Real-IP;

      proxy_connect_timeout 300;

      # To support websocket
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";

      chunked_transfer_encoding off;

      proxy_pass http://minio:9001/; # This uses the upstream directive definition to load balance and assumes a static Console port of 9001
   }
}

S3 API 签名计算算法不支持 minio.example.net/s3/在子路径(例如或)上托管 MinIO Server API 或控制台 GUI 的代理方案 console.example.net/gui。

作者:Jeebiz  创建时间:2023-05-14 23:18
最后编辑:Jeebiz  更新时间:2024-08-02 11:04