Setup Nginx proxy with Minio Server Slack

Nginx is an open source Web server and a reverse proxy server.

In this recipe we will learn how to set up Nginx proxy with Minio Server.

1. Prerequisites

Install Minio Server from here.

2. Installation

Install Nginx from here.

3. Configuration

Standard Root Configuration

Add below content as a file /etc/nginx/sites-enabled and also remove the existing default file in same directory.

server {
 listen 80;
 server_name example.com;
 location / {
   proxy_set_header Host $http_host;
   proxy_pass http://localhost:9000;
 }
}

Note:

Non Root Configuration

When a non root configuration is needed adjust the location definition as follows:

 location ~^/files {
   proxy_buffering off;
   proxy_set_header Host $http_host;
   proxy_pass http://localhost:9000;
 }

Note:

Non Root Configuration With Rewrite

The following location configuration allows for access to any bucket however only through unsigned urls and therefore publically accessible buckets.

 location ~^/files {
   proxy_buffering off;
   proxy_set_header Host $http_host;
   rewrite ^/files/(.*)$ /$1 break;
   proxy_pass http://localhost:9000;
 }

Note:

4. Recipe Steps

Step 1: Start Minio server.

minio server /mydatadir

Step 2: Restart Nginx server.

sudo service nginx restart

Explore Further

Refer this blog post for various Minio and Nginx configuration options.