### 一. 安装 centos7 基础环境

```bash
### 安装 centos7 基础环境 ###
yum -y install wget && wget  http://8.210.81.239/linux/sh/centos7_init.sh && source centos7_init.sh  && rm -f /root/centos7_init.sh

rm -f /etc/profile.d/history.sh
rm -rf /var/log/.hist/

vim /etc/profile
HISTTIMEFORMAT="[%Y-%m-%d %H:%M:%S]  "
HISTSIZE=3000
HISTFILESIZE=3000

source /etc/profile

### 安装 Nginx 
cd &&  yum -y install wget && wget http://8.210.81.239/linux/nginx/install_nginx1.12.sh && source install_nginx1.12.sh && rm -f install_nginx1.12.sh

cd && wget  http://8.210.81.239/minio/minio.conf  && mv minio.conf /opt/nginx/conf/conf.d/

### 在 vim /opt/nginx/conf/nginx.conf ###
修改  client_max_body_size 100m; 为 client_max_body_size 1000m;
```

### 二. 下载Minio

```bash
### 下载 minio ###
wget  http://8.210.81.239/minio/minio  && chmod +x minio && mv minio  /usr/bin/  
### wget  https://dl.min.io/server/minio/release/linux-amd64/minio  ###
### chmod +x minio  ### 
mv minio  /usr/bin/     ### 移动minio到/usr/bin ###
```

###### 二.一  新建文件夹下载配置文件

```bash

mkdir  -p /root/minio/data
wget  http://8.210.81.239/minio/minio.service  && mv minio.service /usr/lib/systemd/system/
wget  http://8.210.81.239/minio/.env  && mv .env  /root/minio/


```

###### 二.二 新建配置文件 下载了配置文件可忽略

```bash

# Volume to be used for MinIO server.
# 数据存放目录
MINIO_VOLUMES="/root/minio/data" 
# Use if you want to run MinIO on a custom port.
# 端口号设置
MINIO_OPTS="--address :9000 --console-address :9001"
# Root user for the server.
# 用户名
MINIO_ROOT_USER=LTAI5t6XYPkQkvm44bhpWmLx 
# Root secret for the server.
# 密码
MINIO_ROOT_PASSWORD=p0auMNV0jhXuP5U4Oe0cngcxTfpTVj 
```



###### 二.三 新建minio.service 下载了配置文件可忽略

```bash
vim /usr/lib/systemd/system/minio.service
### 新建minio.service 
```

```
[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
#minio文件具体位置
AssertFileIsExecutable=/usr/bin/minio

[Service]
#WorkingDirectory=/usr/bin/
# User and group 用户 组
User=root
Group=root
ProtectProc=invisible
#创建的配置文件 minio.conf
EnvironmentFile=/root/minio/.env
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /home/game/minio/data\"; exit 1; fi"
ExecStart=/usr/bin/minio server $MINIO_OPTS $MINIO_VOLUMES

# Let systemd restart this service always
Restart=always

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=1048576

# Specifies the maximum number of threads this process can create
TasksMax=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target
```



```bash
#将服务设置为每次开机启动
systemctl enable minio.service
#重新加载某个服务的配置文件，如果新安装了一个服务，归属于 systemctl 管理，要是新服务的服务程序配置文件生效，需重新加载
systemctl daemon-reload
#启动服务
systemctl start minio
#停止服务
systemctl stop minio
#重启服务
systemctl restrat minio
#查看服务状态
systemctl status minio.service

### 新建桶 在管理里面选择 上市 然后再访问规则里面 添加访问规则 字首写 * 使用权写 读写 ##

```





### Nginx配置文件

```conf
         server {
                 listen 80;
                 listen 443;
                 server_name minio.com;

                 ignore_invalid_headers off;
                 client_max_body_size 0;
                 proxy_buffering off;

                 #access_log  /opt/nginx/logs/minio.com.log;
                 ######如果不需要加证书访问下面这些可以注销######
                 #ssl on;
                 #ssl_certificate       /opt/nginx/conf/cert/ssl/minio.com.pem;
                 #ssl_certificate_key   /opt/nginx/conf/cert/ssl/minio.com.key;
                 #ssl_session_cache shared:SSL:1m;
                 #ssl_session_timeout  10m;
                 #ssl_prefer_server_ciphers on;
                 #ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
                 ######如果不需要加证书访问上面这些可以注销######

                 location / {
                   proxy_pass http://127.0.0.1:9001;
                   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 Host $http_host;
                   proxy_connect_timeout 300;
                   proxy_http_version 1.1;
                   proxy_set_header Connection "";
                   chunked_transfer_encoding off;
                 }
 
                 ###  /group1 修改为桶名字 桶名是什么这个转发名是什么 ###
                 location /group1 {
                   proxy_pass http://127.0.0.1:9000;
                   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 Host $http_host;
                   proxy_connect_timeout 300;
                   proxy_http_version 1.1;
                   proxy_set_header Connection "";
                   chunked_transfer_encoding off;
                 }

                   ### 这段脚本一定要加到server配置内部  ###
                   ### 且if要在access_log前面            ###
                   ###  否则set的变量将无法引用          ###
                   if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
                             set $year $1;
                             set $month $2;
                             set $day $3;

                   }
                   ### /opt/nginx/logs 记得加 777 权限 ###
                   ### chmod 777 /opt/nginx/logs  ###
                   access_log  /opt/nginx/logs/minio.com-$year-$month-$day.log  main;
                   error_log   /opt/nginx/logs/error.log;
                   ###  vim /etc/crontab  # 设置定时任务自动生成日志  ###
                   ###  每天凌晨两点自动执行这个脚本  ###
                   ###  00 2 * * *  root  /opt/sh/ShanChu.sh  ###
                   ###  删除日志脚本在 /opt/ziyuan/Shell/YuMing/ShanChu.sh ###
                   ###  service crond restart  重启crontab ###
                   ###  /etc/init.d/cron restart  重启crontab ###

                   }

```





```
官方文档:  http://docs.minio.org.cn/docs/master/setup-nginx-proxy-with-minio
参考文档:  https://blog.csdn.net/Ever_Ardour/article/details/120838919
参考文档:  https://www.jianshu.com/p/846ad00ebd7e
```







