Serve static assets for serving index.html without the need or S3 API.
Cannot serve static assets like web-hosting even after setting buckets as public.
Write a new plugin for Caddy which can serve files directly from Minio.
This affects all deployments where users want to use Minio but want to serve another endpoint where they can serve their website as well.
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTwebsite.html#RESTBucketPUTwebsite-examples
To enable static website hosting.
Alternative workarounds can address the requirement here. Eg. nginx + read-only bucket policy.
In case anyone comes across this ticket wanting more of a clue about hosting a static site (in this example hugo) from minio via caddy here's my personal notes on what worked for me:
0.11.1http://localtest.me
127.0.0.1 localtest.me
/dataindex.html object: site/index.html instance object: http://localhost:9000/site/index.html
mc config host add myminio http://127.0.0.1:9000 <AccessKey> <SecretKey>
./minio server --address localhost:9000 /data
site bucket in minio
mc mb myminio/site
mc policy download myminio/site
# example
mc cp --recursive ~/MyHugoProject/public/* myminio/site/
Caddyfile
http://localtest.me/myhugosite {
rewrite / {
r ^.*/$
to {path} {path}/ {dir}/index.html
}
proxy / http://localhost:9000/site/ {
#transparent #superfluious
}
}
You may also consider using Nginx https://gist.github.com/harshavardhana/f05b60fe6f96803743f38bea4b565bbf
$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
$ mc policy download myminio/static
Access permission for ‘myminio/static’ is set to ‘download’
$ mc cp -r terrafirma/ myminio/static
...ma/readme.txt: 39.37 KB / 39.37 KB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 31.94 KB/s 1s
Note: this is how my bucket content appears to me currently.
$ mc ls myminio/static
[2017-03-22 18:20:52 IST] 4.7KiB default.css
[2017-03-22 18:20:54 IST] 5.4KiB index.html
[2017-03-22 18:20:54 IST] 612B readme.txt
[2017-03-22 18:24:03 IST] 0B images/
static from Minio. Remove default configuration and replace it with the below. Please change as per your local setup.
$ cat /etc/nginx/sites-enabled/default
server {
listen 80;
server_name localhost;
location / {
rewrite ^/$ /static/index.html break;
proxy_set_header Host $http_host;
proxy_pass http://localhost:9000/static/;
}
}
$ sudo service nginx reload
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
In case anyone comes across this ticket wanting more of a clue about hosting a static site (in this example hugo) from minio via caddy here's my personal notes on what worked for me:
Serve static pages from minio through caddy
Assumptions:
0.11.1http://localtest.me127.0.0.1 localtest.me/dataindex.htmlobject:site/index.htmlinstance object:http://localhost:9000/site/index.htmlmc config host add myminio http://127.0.0.1:9000 <AccessKey> <SecretKey>General procedure:
./minio server --address localhost:9000 /datasitebucket in miniomc mb myminio/sitemc policy download myminio/site# example mc cp --recursive ~/MyHugoProject/public/* myminio/site/Caddyfilehttp://localtest.me/myhugosite { rewrite / { r ^.*/$ to {path} {path}/ {dir}/index.html } proxy / http://localhost:9000/site/ { #transparent #superfluious } }