Home Deploy Static Website with Nginx and MinIO
Post
Cancel

Deploy Static Website with Nginx and MinIO

Setelah install MinIO, pada panduan kali ini akan membahas cara untuk mendeploy static site dengan nginx dan minio. Ini akan mirip seperti mendeploy static site pada AWS cloudfront dengan AWS s3 sebagai penyimpanan object atau file website.

Create bucket

Buat bucket dengan nama static

1
mc mb local/static

Lalu upload file website ke bucket

1
2
cd /var/www/site
cp -r ./* local/static

Setting Access Policy ke Public

1
mc anonymous set public local/static

Install Nginx

Install nginx

1
yum install nginx

Buat dan edit file /etc/nginx/conf.d/static.conf

1
2
3
4
5
6
7
8
9
server {
 listen 80;
 server_name example.com;
 location / {
   rewrite ^/$ /static/index.html break;
   proxy_set_header Host $http_host;
   proxy_pass http://<ip-minio>:9000;
 }
}

Enable dan start nginx

1
systemctl enable --now nginx

Test akses http://example.com melalui browser Anda.

This post is licensed under CC BY 4.0 by the author.