搭建MinIo
docker run \
-itd \
-p 9000:9000 \
-p 9001:9001 \
--name minio \
-e "MINIO_ROOT_USER=账户" \
-e "MINIO_ROOT_PASSWORD=密码" \
-v /dcoker/minio/data:/data \
quay.io/minio/minio server /data --console-address ":9001"
内部搭建的MinIo服务器映射到外网后访问文件资源一直报认证异常,经资料查阅minio有自己一套加密校验逻辑,访问时不可改动其桶名
解决内网穿透minio访问异常问题
通过nginx进行代理,代理时不改变访问路径,外网映射时映射nginx的代理地址文章来源:https://www.toymoban.com/news/detail-506458.html
docker pull nginx
docker run --name nginx -d -p81:80 -itd nginx
mkdir -p /usr/local/docker-soft/nginx/conf
mkdir -p /usr/local/docker-soft/nginx/conf.d
docker cp nginx:/etc/nginx/nginx.conf /usr/local/docker-soft/nginx/conf/nginx.conf
docker cp nginx:/etc/nginx/conf.d/default.conf /usr/local/docker-soft/nginx/conf.d/default.conf
docker rm -f nginx
# 启动镜像并挂载
docker run --name nginx -d -it \
-p 80:80 \
-v /usr/local/docker-soft/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /usr/local/docker-soft/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf \
nginx
修改Nginx配置文章来源地址https://www.toymoban.com/news/detail-506458.html
server {
listen 80;
# 这里对应桶名
location /访问的桶名/ {
proxy_read_timeout 600s;
# 配置minio访问地址与桶名
proxy_pass http://minio服务器IP:端口/访问的桶名/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Special-Delivery "";
proxy_set_header Access-Control-Allow-Origin "";
proxy_set_header Proxy-Client-IP $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header X-Special-Delivery "stop-polling-our-interface-you-bitch" always;
add_header Access-Control-Allow-Origin "you-poll-your-mama-blyat" always;
}
}
到了这里,关于docker搭建minio服务器,解决内网穿透后外网无法访问问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!