minio安装
一.下载Minio
#在线下载二进制文件
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
二.编辑Service文件
vi /usr/lib/systemd/system/minio.service
#写入如下内容
[Unit]
Description=Minio Service
[Service]
Environment="MINIO_ROOT_USER=admin"
Environment="MINIO_ROOT_PASSWORD=paco1234"
Environment="MINIO_BROWSER_REDIRECT_URL=http://192.168.6.131:18081/minio/ui"
ExecStart=/home/minio/minio server /home/minio/data --address ":9800" --console-address ":9889"
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
StandardOutput=/home/minio/minio.log
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Environment:在启动的时候生命环境变量,这一步操作可以免去在/etc/profile中增加环境变量的步骤。其中,MINIO_BROWSER_REDIRECT_URL是Minio通过Nginx代理后的地址。
# 重新刷新
sudo systemctl daemon-reload
# 启动
sudo systemctl start minio.service
# 查看状态
systemctl status minio -l
# 开机自启
sudo systemctl enable minio.service
配置nginx
server {
listen 18081;
listen [::]:18081;
server_name localhost;
# Allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
# Disable buffering
proxy_buffering off;
proxy_request_buffering off;
location /minio-api/ {
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-Proto $scheme;
proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://192.168.6.131:9800/;
}
location /minio/ui/ {
rewrite ^/minio/ui/(.*) /$1 break;
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-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
# This is necessary to pass the correct IP to be hashed
real_ip_header X-Real-IP;
proxy_connect_timeout 300;
# To support websockets in MinIO versions released after January 2023
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Some environments may encounter CORS errors (Kubernetes + Nginx Ingress)
# Uncomment the following line to set the Origin request to an empty string
# proxy_set_header Origin '';
chunked_transfer_encoding off;
proxy_pass http://192.168.6.131:9889/; # This uses the upstream directive definition to load balance
}
}
通过配置的Service中的MINIO_BROWSER_REDIRECT_URL地址即可访问MinIO
浙公网安备 33010602011771号