v1.0

MinIO S3 Object Storage

Nginx перед MinIO — S3-совместимое хранилище с SSL

Пример конфига
nginx.conf
upstream minio_api {
    server 127.0.0.1:9000;
    keepalive 32;
}

upstream minio_console {
    server 127.0.0.1:9001;
    keepalive 8;
}

# HTTP → HTTPS редирект
server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

# MinIO S3 API
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1d;

    server_tokens off;
    client_max_body_size 1g;

    access_log /var/log/nginx/minio-access.log combined;
    error_log  /var/log/nginx/minio-error.log warn;

    location / {
        proxy_pass http://minio_api;
        proxy_http_version 1.1;
        proxy_set_header Host              $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 Connection        "";
        proxy_read_timeout    300s;
        proxy_connect_timeout 30s;
        proxy_send_timeout    300s;
        proxy_buffering off;
        proxy_request_buffering off;
        chunked_transfer_encoding on;
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html { root /usr/share/nginx/html; }
}

# MinIO Console (веб-интерфейс)
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name console.example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 1d;

    server_tokens off;
    client_max_body_size 1m;

    location / {
        proxy_pass http://minio_console;
        proxy_http_version 1.1;
        proxy_set_header Upgrade    $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host       $host;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_read_timeout 900s;
    }
}
Как настроить
  1. Установите MinIO: wget https://dl.min.io/server/minio/release/linux-amd64/minio && chmod +x minio
  2. Запустите MinIO: MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=password ./minio server /data --console-address :9001
  3. Получите SSL-сертификат для обоих доменов: certbot certonly --nginx -d example.com -d console.example.com
  4. Скопируйте конфиг в /etc/nginx/sites-available/ и создайте символическую ссылку
  5. Проверьте синтаксис и перезагрузите: nginx -t && systemctl reload nginx