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.
Install Minio Server from here.
Install Nginx from here.
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_buffering off;
proxy_set_header Host $http_host;
proxy_pass http://localhost:9000;
}
}
Note:
- Replace example.com with your own hostname.
- Replace
http://localhost:9000
with your own server name. - Add
client_max_body_size 1000m;
in thehttp
context in order to be able to upload large files — simply adjust the value accordingly. The default value is1m
which is far too low for most scenarios.
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:
- Replace
http://localhost:9000
with your own server name. - Replace
files
with the desired path. This cannot be~^/minio
sinceminio
is a reserved word in minio. - The path used (in this case
files
) will, by convension, be the name of the bucket used by minio. - Other buckets can be accessed by adding more location definitions similar to the one defined above.
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:
- Replace
http://localhost:9000
with your own server name. - Replace
files
with the desired path. - The buckets used must be publicly available, typically for both reading and writing.
- The url used must be unsigned since nginx will change the url and invalidate the signature in the process.
minio server /mydatadir
sudo service nginx restart
Refer this blog post for various Minio and Nginx configuration options.