Static Website with Minio

9月 23, 2017 tech post

Minio is an open source object storage server with Amazon S3 compatible API. We can use Nginx + read-only bucket policy to host a static website.

First, put your static files in a public bucket in Minio ( such as site ), then configure Nginx to serve all static assets from Minio server:

# localhost
location / {
  proxy_pass http://minio.example.com/site;
}

You can access your site by http://localhost/index.html for now.

If you do not want to add index.html by manual, use rewrite:

location / {
  rewrite ^/?$ /site/index.html break;
  rewrite ^/([a-zA-Z/-]+[^/])/?$ /site/$1/index.html break;
  proxy_pass https://minio.example.com/site;
}