nginx配置:
server {
listen 443 ssl;
server_name minio.ronshi.net;
ssl_certificate /usr/share/nginx/html/cert/minio.ronshi.net.pem;
ssl_certificate_key /usr/share/nginx/html/cert/minio.ronshi.net.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# MinIO API代理(路径/minio)
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_pass http://localhost:9000;
proxy_http_version 1.1;
rewrite ^/minio/(.*) /$1 break;
proxy_redirect off;
}
# MinIO控制台代理(路径/minio-console)
location /minio-console/ {
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_pass http://localhost:9090; # 管理端口代理
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
rewrite ^/minio-console/(.*) /$1 break;
proxy_redirect off;
proxy_cookie_path / /minio-console/; # 适配Cookie路径
}
}
docker 启动minio命令:
docker run -d --network host --name minio --restart=always -e "MINIO_ACCESS_KEY=minio" -e "MINIO_SECRET_KEY=ronshi" -e "MINIO_SERVER_URL=https://minio.ronshi.net" -e "MINIO_BROWSER_REDIRECT_URL=https://minio.ronshi.net/minio-console" -v /mnt/data/minio/data:/data -v /mnt/data/minio/config:/root/.minio minio/minio server /data --console-address ":9090" --address ":9000"