avatar

Moon编程小筑

分享编程知识,我们一起进步!

  • 首页
  • 分类
  • 标签
  • 归档
Home Nginx服务器反向代理MinIO配置
文章

Nginx服务器反向代理MinIO配置

Posted 2024-03-18 Updated 2024-03- 18
By Administrator
7~10 min read

Nginx服务器反向代理MinIO配置

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

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

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

  • 将请求代理到 https://minio.example.net​ 的根目录到监听在 https://minio.local:9000​ 的 MinIO 服务器。

  • 将请求代理到 https://minio.example.net/minio/ui​ 子路径到监听在 https://minio.local:9001​ 的 MinIO 控制台。

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

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

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

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_s3; # This uses the upstream directive definition to load balance
   }

   location /minio/ui/ {
      rewrite ^/minio/ui/(.*) /$1 break;
      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";
      # Some environments may encounter CORS errors (Kubernetes + Nginx Ingress)
      # Uncomment the following line to set the Origin request to an empty string
      # proxy_set_header Origin '';

      chunked_transfer_encoding off;

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

其中nginx代理的控制面板配置中,必须有rewrite ^/minio/ui/(.*) /$1 break;​

S3 API签名计算算法 不 支持通过代理方案来托管MinIO服务器API的情况,例如 example.net/s3/​。

您还必须为MinIO部署设置以下环境变量:

  • 将 MINIO\_SERVER\_URL​ 设置为MinIO服务器的代理主机FQDN( https://minio.example.net​ )

  • 将 MINIO\_BROWSER\_REDIRECT\_URL​ 设置为代理主机的 FQDN (https://example.net/minio/ui​)

‍

License:  CC BY 4.0
Share

Further Reading

OLDER

NEWER

欢迎页

Recently Updated

  • 欢迎页
  • Nginx服务器反向代理MinIO配置

Trending Tags

self

Contents

©2025 Moon编程小筑. Some rights reserved.

备案图标.png 豫公网安备41052602000515

豫ICP备2024053499号-1

Using the Halo theme Chirpy