**起因:因為用到ruoyi-vue-plus框架中遇到生產環境是https,但是http的minio上傳的文件不能在后臺系統中訪問**
- 安裝配置minio
- 1. 下載安裝
- 2. 賦文件執行權限
- 3.創建配置文件
- 4.創建minio.service
- 新版minio創建桶需要配置桶權限
- 1.下載客戶端
- 2.設置訪問權限
- 3.連接客戶端
- 4.設置桶權限
- nginx配置https
- 1.申請創建證書
- 2.修改證書文件名(必須修改)
- 3.nginx的https代理參考配置
安裝配置minio
1. 下載安裝
mkdir /usr/local/minio && cd /usr/local/minio && mkdir bin data
cd bin
wget https://dl.min.io/server/minio/release/linux-amd64/minio
2. 賦文件執行權限
cd /usr/local/minio
chmod +x bin/minio
3.創建配置文件
mkdir conf
cd conf
vim minio.conf
minio.conf配置文件內容
#用戶名
MINIO_ROOT_USER="minio"
#密碼
MINIO_ROOT_PASSWORD="Admin@1996"
#配置https或者為了不暴露端口再用到
#MINIO_SERVER_URL="https://minio.**.com/"
#MINIO_BROWSER_REDIRECT_URL="https://minio.**.com/web/"
4.創建minio.service
cd /etc/systemd/system
vim minio.service
minio.service內容
[Unit]
Description=Minio
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/minio/bin/minio[Service]
EnvironmentFile=/usr/local/minio/conf/minio.conf
WorkingDirectory=/usr/local/minio/
PermissionsStartOnly=true
ExecStart=/usr/local/minio/bin/minio server --console-address :9001 /usr/local/minio/data
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true[Install]
WantedBy=multi-user.target
5.服務啟動命令
#將服務設置為每次開機啟動
systemctl enable minio.service
#啟動服務
systemctl start minio
#停止服務
systemctl stop minio
#重啟服務
systemctl restrat minio
#查看服務狀態
systemctl status minio.service
新版minio創建桶需要配置桶權限
1.下載客戶端
wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc
2.設置訪問權限
chmod +x /usr/local/bin/mc
3.連接客戶端
mc alias set myminio http://localhost:9000 登陸賬號 登陸密碼
4.設置桶權限
mc anonymous set download myminio/桶名稱
nginx配置https
1.申請創建證書
我使用的證書是通過阿里云申請創建證書,下載Apache格式。網上那些自己申請創建的證書應該也是可以的,沒有測試。
2.修改證書文件名(必須修改)
并且把名字修改為private.key和public.crt放在/root/.minio/certs(安裝minio自動創建的目錄)路徑下
3.nginx的https代理參考配置
server {listen 443 ssl;http2 on;server_name minio.yuming.com; ssl_certificate /www/zuche/cert/minio.yuming.com.pem; #nginx證書文件位置 用的也是阿里的相同證書ssl_certificate_key /www/zuche/cert/minio.yuming.com.key; #nginx證書文件配置 用的也是阿里的相同證書ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;ssl_prefer_server_ciphers on;location / {keepalive_timeout 105s;proxy_connect_timeout 300s;proxy_send_timeout 600s;proxy_read_timeout 600s;client_max_body_size 500m;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-Host $http_host;proxy_set_header X-Forwarded-Port $server_port;proxy_set_header X-Forwarded-Proto $scheme;proxy_buffering off;proxy_pass https://localhost:9000/;}location /web/ {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-Host $http_host;proxy_set_header X-Forwarded-Port $server_port;proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";proxy_buffering off;proxy_pass https://localhost:9001/;}} #http forced jump https http強制跳轉https配置server{ listen 80;server_name minio.skwl1688.com;rewrite ^(.*)$ https://minio.yuming.com/;location ~ / {index index.html index.php index.htm;}}