Open Adigezalov opened 2 years ago
Issue is now considered stale. If you want to keep it open, please comment :+1:
如果你需要部署对象存储的网站是https,需要在Nginx Proxy Manager 中进行反代,并在路由器进行端口映射。例如:端口映射到99,那你的endpoint就变成了https://域名:99
# 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;
}
详解两个坑的解决方案
官网Issues上这类问题很多:https://github.com/NginxProxyManager/nginx-proxy-manager/issues?q=minio
具体解方法:详见官方文档:https://www.minio.org.cn/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html
注意: Scheme 要改成 https (如果没有放置TLS证书请用http) Forward Hostname / IP minio 是容器的名称 Forward Port * 99 是容器的内部端口,注意区分,不是映射到主机的端口9080
# 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:99;
}
注意: https://minio:99 # 要改成 https (如果没有放置TLS证书请用http),99 是容器内部端口
注意: Scheme 要改成 https 如果没有放置TLS证书请用http Forward Hostname / IP minio 是容器的名称 Forward Port * 9090 是容器的内部端口
复制下列代码:
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 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:9090;
}
注意: https://minio:9090 # 要改成 https (如果没有放置TLS证书请用http),9090 是容器内部端口
如果不加这段代码,会出现如下情况(坑点,原因不明)
会一直打圈,不能显示列表
经阅读官方文档:https://www.minio.org.cn/docs/minio/linux/integrations/setup-nginx-proxy-with-minio.html
对于个人的私有化布署,不太友好,官方文档也没说清楚
您还必须为MinIO部署设置以下环境变量:
将 MINIO_SERVER_URL 设置为MinIO服务器的代理主机FQDN( https://minio.example.net )
将 MINIO_BROWSER_REDIRECT_URL 设置为代理主机的 FQDN (https://example.net/minio/ui)
version: "3.7"
services:
minio:
image: minio/minio
container_name: minio
command: server --address ":9000" --console-address ":9090" /data # 指定服务端口和管理端口
ports:
- 9080:9000 # :前面的自行定义,服务端口:API: http://IP:9080
- 9090:9090 # :前面的自行定义,管理端口:http://IP:9090
volumes:
- ./data:/data # 数据目录
- ./config:/root/.minio # TLS 密钥和证书存放在 ./config/certs
environment:
- MINIO_ROOT_USER=admin # 用户名,自行修改
- MINIO_ROOT_PASSWORD=password # 密码,自行修改
- MINIO_SERVER_URL=https://api.example.com:99 # 自行修改成自已的域名# 反向代理的服务域名,用于文件分享外部url,":99" 是反向代理后公网访问端口
- MINIO_BROWSER_REDIRECT_URL=https://s3.example.com:99 # 自行修改成自已的域名# 反向代理的登录域名,":99" 是反向代理后公网访问端口
restart: unless-stopped # 总是重启容器
docker-compose up -d
大多数并没有给我带来帮助:https://github.com/minio/minio/issues?q=MINIO_ROOT_USER
有一篇提问提到这个问题:
minio启动后,会主动验证~ MINIO_SERVER_URL=https://api.example.com:99 ~的可通性
面临两个问题: A.反向代理后方,无证书 B.反向代理后方,内部如何域名解析到127.0.0.1
对于个人单机单点的私有化布署,不太友好,官方文档也没说清楚
官方文档详见:https://www.minio.org.cn/docs/minio/linux/operations/network-encryption.html
使用 MinIO 的 certgen 工具来生成自签名的TLS证书的方法,详见:https://www.cnblogs.com/hahaha111122222/p/15984957.html
下载地址:https://github.com/minio/certgen/releases/tag/v0.0.2
下载certgen-windows-amd64.exe 放到任意文件夹,例如:.\desktop\1
certgen -ca -host "主机IP,minio容器运行IP,两个域名,hostname" 实际执行的生成证书的命令:
./certgen-windows-amd64.exe -ca -host "127.0.0.1,192.168.30.2,172.18.0.22,api.example.com,s3.example.com,minio"
显示:
2022/03/09 14:10:58 wrote public.crt 2022/03/09 14:10:58 wrote private.key 如图:
解释一下ip和域名:
127.0.0.1 主机环回地址 192.168.30.2 主机ip 172.18.0.22 容器内ip api.example.com 服务域名 s3.example.com 管理域我 minio hostname
复制public.crt private.key 到 主机的./config 映射目录下
可以在docker-compose中增加dns记录解决
extra_hosts:
api.example.com : 127.0.0.1 # 自行修改服务域名
s3.example.com : 127.0.0.1 # 自行修改服务域名
家庭网络环境中,路由器会转发端口 例如: A路由器外部公网端口:99 #运营商限制不能使用80 没办法只能用99代替 B反向代理端口:80/443 C主机端口:9080 # 详见docker-compose 的配置 D容器内部端口:9000
访问的传递是 A->B->C->D
在容器内部,无法使用99端口
这就需要将容器服务端口与外部端口统一使用 “:99”
version: "3.7"
services:
minio:
image: minio/minio
container_name: minio
command: server --address ":99" --console-address ":9090" /data # 指定服务端口和管理端口
ports:
- 9080:99 # :前面的自行定义,服务端口:API: http://IP:9080
- 9090:9090 # :前面的自行定义,管理端口:http://IP:9090
extra_hosts:
api.example.com : 127.0.0.1 # 自行修改服务域名
s3.example.com : 127.0.0.1 # 自行修改服务域名
volumes:
- ./data:/data # 数据目录
- ./config:/root/.minio # TLS 密钥和证书存放在 ./config/certs
environment:
- MINIO_ROOT_USER=admin # 用户名,自行修改
- MINIO_ROOT_PASSWORD=password # 密码,自行修改
- MINIO_SERVER_URL=https://api.example.com:99 # 自行修改成自已的域名# 反向代理的服务域名,用于文件分享外部url,":99" 是反向代理后公网访问端口
- MINIO_BROWSER_REDIRECT_URL=https://s3.example.com:99 # 自行修改成自已的域名# 反向代理的登录域名,":99" 是反向代理后公网访问端口
- MINIO_STS_DURATION=168h # 文件分享外部url 最大时长 7天,超过7天无效,永久分享的方法:Buckets(存储块)Access Policy设为 public,链接文件名后面“?及以后的代码”删除。比较危险,通过Buckets路径,可以看到所有文件的目录。
restart: unless-stopped # 总是重启容器
docker-compose up -d
------------完毕------------
Hi. I need help installing minio through a nginx-proxy-manager. I'm not a professional devops so this question makes me panic. I installed nginx-proxy-manager and minio in docker containers. Set up all the necessary urls. Now I have url console.DOMAIN.com that enters the console, and url minio.DOMAIN.com can connect to api minio to send files. Through the console everything works fine. But the problem is that when sending a file from the frontend, minio gives me the following error: MinIO API responded with message=The request signature we calculated does not match the signature you provided. Check your key and signing method. I understand that this means that somewhere my nginx-proxy has lost some headers. But I don’t understand which ones and how to install them exactly in the nginx-proxy-manager.