Docker部署Minio并配置域名访问
1、拉取镜像
docker pull minio/minio:RELEASE.2024-08-03T04-33-23Z-cpuv1
2、启动容器
# 创建数据目录
mkdir /data/minio
# 创建配置目录
mkdir /root/.minio
# 启动容器(如果不配置域名访问MINIO_BROWSER_URL、MINIO_SERVER_URL可以不用配置)
docker run \
-p 9000:9000 \
-p 9090:9090 \
--name minio \
-d --restart=always \
-e "MINIO_ACCESS_KEY=xumeng03" \
-e "MINIO_SECRET_KEY=${PASSWORD}" \
-e "MINIO_BROWSER_URL=https://minio.xumeng03.com" \
-e "MINIO_SERVER_URL=https://minioapi.xumeng03.com" \
-v /data/minio:/data \
-v /root/.minio:/root/.minio \
minio/minio:RELEASE.2024-08-03T04-33-23Z-cpuv1 server \
/data --console-address ":9090" -address ":9000"
3、Nginx配置
worker_processes auto;
events {
worker_connections 1024;
}
http {
client_max_body_size 100m;
server {
listen 80;
server_name minio.xumeng03.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name minio.xumeng03.com;
ssl_certificate /etc/nginx/minio.xumeng03.com_bundle.crt;
ssl_certificate_key /etc/nginx/minio.xumeng03.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://124.222.145.150:9090;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
server_name minioapi.xumeng03.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name minioapi.xumeng03.com;
ssl_certificate /etc/nginx/minioapi.xumeng03.com_bundle.crt;
ssl_certificate_key /etc/nginx/minioapi.xumeng03.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://124.222.145.150:9000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}
4、访问控制台
https://minio.xumeng03.com/login