Search code examples
nginxminio

MC timed out but Minio console admin works fine


I'm struggling on this problems since 3 weeks. I use Minio on a server, everything work fine I have access to console admin with the url https://minio.my-website.co, it works fine (I'm using community edition).

When I try to set up Minio Client with this command :

mc alias alias set cfb https://minio.my-website.co:9000 demo password123

I got this error mc: <ERROR> Unable to initialize new alias from the provided credentials. Get "https://minio.my-website.co:9000": dial tcp xxx.xx.xx.107: connect: connection timed out.

My first idea it was to check my firewall UFW, the port 9000 and 9001 is open. My second idea was to check my credentials, so I create a new user. I check, my NGINX configuration :

server {

    # SSL configuration
    listen 443 ssl;
    listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem; # managed by Certbot

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name minio.xxxx.com:9000;

    ignore_invalid_headers off;

    proxy_buffering off;

    proxy_request_buffering off;

    location / {

            proxy_pass         https://localhost:9001;

            proxy_http_version 1.1;

            proxy_set_header   Upgrade $http_upgrade;

            proxy_set_header   Connection keep-alive;

            proxy_set_header Connection "upgrade";

            proxy_set_header   Host $host;

            proxy_cache_bypass $http_upgrade;

            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

            proxy_set_header   X-Forwarded-Proto $scheme;

            proxy_connect_timeout 400;

            chunked_transfer_encoding off;

            proxy_set_header X-Real-IP $remote_addr;

            proxy_set_header X-Forwarded-Proto $scheme;


    }

}

}


server {

 listen 80;

 server_name http://minio.xxxx.com:;

 location / {

   proxy_set_header Host $host;

   proxy_set_header X-Real-IP $remote_addr;

   proxy_set_header X-Forwarded-Proto $scheme;

   proxy_set_header X-NginX-Proxy true;

   proxy_pass http://localhost:9000;

   real_ip_header X-Real-IP;

 }

}

server {

    if ($host = minio.xxxx.com) {

        return 301 https://$host$request_uri;

    } # managed by Certbot





        listen 80 default_server;

        listen [::]:80 default_server;

        server_name minio.xxxx.com;

    return 404; # managed by Certbot
}

I also tried some environnement variable MINIO_SERVER_URL and MINIO_BROWSER_REDIRECT_URL on etc/default/minio. But nothing change after a reset of minio server.

I'm completly lost with this problems. Also, I'm not a sys-admin that's why I'm thinking it's my nginx conf who are not set properly.


Solution

  • The answer is simple, but the error message may be better for beginners. I hadn't realized that Minio uses two ports (9000 and 9001). The port 9000 call the API and the port 9001 and the graphical interface. You can see in the location I call the graphical interface instead of API.

    My solution was to make a subdomain console and my minio subdomain link the console with the graphical interface and link minio with the API.

    You can find here more information : S3 API error ; NGINX conf exemple for Minio