Docker Minio 实现文件永久链接

  1. 启动Minio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

BASEPATH=`pwd`
NAME=minio

docker rm -f $NAME
docker run -d --name $NAME \
--restart=always \
-v $BASEPATH/data:/data \
-v $BASEPATH/conf:/root/.minio \
-e "MINIO_SERVER_URL=https://APIHost地址" \ # 文件分享地址
-e "MINIO_BROWSER_REDIRECT_URL=https://minio地址" \ # 页面查看地址
-e "MINIO_ROOT_USER=xxxx" \
-e "MINIO_ROOT_PASSWORD=xxxx" \
minio/minio \
server ./data --console-address ":9001" --address ":9000"
docker logs -f $NAME
  1. Nginx 配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    server {
    listen 80;
    listen [::]:80;
    server_name xxxx;
    return 301 https://$server_name$request_uri;
    }

    server {
    listen 443 ssl http2;
    server_name xxxx;
    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://minio:9001/; # API自行配置9000
    }
    ssl_certificate /usr/local/openresty/nginx/cert/fullchain.cer;
    ssl_certificate_key /usr/local/openresty/nginx/cert/ifan.host.key;
    ssl_protocols TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    access_log /usr/local/openresty/nginx/logs/minio.access.log;
    error_log /usr/local/openresty/nginx/logs/minio.error.log;
    }
  2. 配置本地mc

1
2
3
4
5
6
7
8
9
10
11
12
{
"version": "10",
"aliases": {
"minio": {
"url": "https://API地址",
"accessKey": "xxxx",
"secretKey": "xxx",
"api": "s3v4",
"path": "auto"
}
}
}
  1. 设置永久链接
1
2
# 设置桶为匿名可读
mc anonymous set download minio/桶名称