Created
March 22, 2017 13:08
-
-
Save koolhead17/4b8dd8d95ec86368634693cf9ad9391c to your computer and use it in GitHub Desktop.
nginx-minio-staticsite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OS: Ubuntu 16.04 | |
1. Install nginx : nginx version: nginx/1.10.0 (Ubuntu) | |
2. Install Minio: Follow https://github.com/minio/minio | |
3. Install MC client: Follow https://github.com/minio/mc | |
4. Create a bucket: | |
$ mc mb myminio/static | |
Bucket created successfully ‘myminio/static’. | |
5. Make bucket public to host/access static content. | |
$ mc policy download myminio/static | |
Access permission for ‘myminio/static’ is set to ‘download’ | |
6. Upload a sample static HTML site to minio bucket, in my case i used example: http://www.oswd.org/user/profile/id/12362/ | |
$ 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/ | |
6. Configure Nginx as proxy to serve static pages from public bucket name ``static`` from Minio. | |
# Remove defualt 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/; | |
} | |
} | |
#Reload Nginx | |
$ sudo service nginx relaod | |
7. Open your browser and typel localhost [as per my example] | |
Screenshot: https://play.minio.io:9000/atuljha/minionginxstatic.png | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment