Docker - Minio对象存储部署
Minio 是一个基于 Apache License v2.0 开源协议的对象存储服务。非常适合于存储大容量非结构化的数据,例如图片、视频、日志文件、备份数据和容器/虚拟机镜像等,而一个对象文件可以是任意大小,从几kb到最大5T不等。集群部署也是非常的简单,本篇文章只讨论单机部署,集群有需要后续跟进。
一、拉取镜像
docker pull minio/minio:RELEASE.2021-06-14T01-29-23Z
二、安装程序
docker run -d \ --name minio-server \ --restart=always \ -p 9000:9000 \ -e "MINIO_ROOT_USER=minio" \ # 账号 -e "MINIO_ROOT_PASSWORD=manongdashu" \ # 密码 -v /etc/localtime:/etc/localtime:ro \ -v /etc/timezone:/etc/timezone:ro \ -v /data/minio/data:/data \ # 映射 数据文件 -v /data/minio/config:/root/.minio \ # 映射 配置文件 minio/minio:RELEASE.2021-06-14T01-29-23Z server /data
三、访问测试
IP:端口
权限分配
四、域名配置
管理页面配置
# Minio 管理页面 upstream minio { server 127.0.0.1:9000; # 代理集群时添加多个 } server { listen 80; # 监听端口 server_name minio.renzicu.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name minio.renzicu.com; ssl_certificate /etc/nginx/cert/5950256_minio.renzicu.com.pem; ssl_certificate_key /etc/nginx/cert/5950256_minio.renzicu.com.key; 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; ssl_prefer_server_ciphers on; location / { proxy_redirect off; proxy_pass http://minio; # 转发规则 proxy_set_header X-Forwarded-Host $host; # 修改转发请求头 proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; expires off; sendfile off; } }
资源访问配置
# 用户访问 server { listen 80; # 监听端口 server_name static.renzicu.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name static.renzicu.com; ssl_certificate /etc/nginx/cert/5945797_static.renzicu.com.pem; ssl_certificate_key /etc/nginx/cert/5945797_static.renzicu.com.key; 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; ssl_prefer_server_ciphers on; location / { root /data; # 资源根目录,如果nginx运行在docker内,需要注意docker是否有映射此目录 index /usr/share/nginx/html/index.html; proxy_redirect off; proxy_set_header X-Forwarded-Host $host; # 修改转发请求头 proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; expires off; sendfile off; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } ## 需要nginx安装 nginx-module-image-filter模块 # 生成缩略图(等比例),示例 http://xxx.com/1.jpg!128x128 location ~* /(.+)\.(jpg|jpeg|gif|png)!(\d+)x(\d+)$ { set $w $3; set $h $4; root /data; # 这里一定要写,否则不生效 image_filter resize $w $h; image_filter_buffer 10M; image_filter_jpeg_quality 75; try_files /$1.$2 /notfound.jpg; } # 生成裁切图片(固定高宽),示例 http://xxx.com/1.jpg!128_128 location ~* /(.+)\.(jpg|jpeg|gif|png)!(\d+)_(\d+)$ { set $w $3; set $h $4; root /data; # 这里一定要写,否则不生效 image_filter crop $w $h; image_filter_buffer 10M; image_filter_jpeg_quality 75; try_files /$1.$2 /notfound.jpg; } }
五、扩展插件
1.nginx-module-image-filter 模块,参考之前的文章 Docker - Nginx部署
莫谈他人高薪,且看闲时谁在拼.