1.下载与安装
1.1.下载
https://dl.min.io/server/minio/release/linux-amd64/minio
1.2.运行
窗口模式运行:./minio server /data --console-address “:9001”
后台模式运行:nohup ./minio server /data --console-address “:9001”
如果需要指定用户名和密码,在窗口(或后台)模式的命令之前加上下面的命令即可:
MINIO_ROOT_USER=用户名 MINIO_ROOT_PASSWORD=密码
注意:
1.如果不指定用户名和密码,将使用默认的用户名(minioadmin)和密码(minioadmin)
2. /data:数据存放目录
3.–console-address:指定控制台端口,如果不指定,将使用随机端口。
4.默认的API端口为9000,如需指定端口,在数据存放目录后面加上
“–address ‘指定的端口’” 即可
2.配置SSL,支持https访问
注意:minio本身只支持http,不支持https
2.1.方式一:使用官网推荐的方式
官网地址:http://docs.minio.org.cn/docs/master/how-to-secure-access-to-minio-server-with-tls
注意:公钥名称必须是public.crt,私钥名称必须是private.key,如果使用第三方CA证书(例如阿里云),下载nginx版本的证书即可,xxx.key格式的证书就是私钥,xxx.pem格式的证书就是公钥,pem格式转crt的命令如下所示:
openssl x509 -in xxx.pem -out xxx.crt
该命令由于openssl只有Linux版本,故只能在Linux上面运行。
2.2.方式二,使用nginx反向代理(推荐)
nginx官网地址:https://www.nginx.cn/doc/
如果nginx只需要代理一个服务,按照以下配置即可:
upstream minio_server {
server 127.0.0.1:9000;
ip_hash;
}
server {
listen 端口 ssl;
server_name 域名或IP;
ssl_certificate 证书公钥;
ssl_certificate_key 证书私钥;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://minio_server;
proxy_redirect off;
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;
}
}
如果nginx需要代理多个服务,按照请求地址加以区分即可:
同时支持https和http:
server {
listen 80 default backlog=2048;
listen 443 ssl;
server_name www.scaszh.com 121.37.214.107;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl性能调优
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate /usr/local/nginx/https/1_www.scaszh.com_bundle.crt; #证书公钥
ssl_certificate_key /usr/local/nginx/https/2_www.scaszh.com.key; #证书私钥
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
alias /aoshenapp/static/;
index index.html index.htm;
}
location ^~/farm-ui {
root /apps/farm/static/;
index index.html index.html;
try_files $request_uri $uri /farm-ui/index.html;
# default_type text/html;
# return 200 $request_filename;
}
只支持https:
upstream minio_server {
server 127.0.0.1:9000;
ip_hash;
}
server {
listen 80 default backlog=2048;
listen 443 ssl;
server_name www.scaszh.com 121.37.214.107;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl性能调优
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_certificate /usr/local/nginx/https/1_www.scaszh.com_bundle.crt; #证书公钥
ssl_certificate_key /usr/local/nginx/https/2_www.scaszh.com.key; #证书私钥
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
alias /aoshenapp/static/;
index index.html index.htm;
}
location ^~/farm-ui {
proxy_pass http://minio_server;
proxy_redirect off;
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;
}
注意:^~/farm-ui表示精确匹配带有/farm-ui字符串的请求地址