From da99d102e9465a50aa38a724a7ac6141721f65d0 Mon Sep 17 00:00:00 2001 From: Timothy Kim Date: Thu, 19 Mar 2026 18:23:39 -0400 Subject: [PATCH] add s3.hantim.net proxy, fix dns ttl to 3600 --- docker/nginx/conf.d/s3.hantim.net.conf | 32 ++++++++++++++++++++++++++ tools/new-app.sh | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 docker/nginx/conf.d/s3.hantim.net.conf diff --git a/docker/nginx/conf.d/s3.hantim.net.conf b/docker/nginx/conf.d/s3.hantim.net.conf new file mode 100644 index 0000000..b329892 --- /dev/null +++ b/docker/nginx/conf.d/s3.hantim.net.conf @@ -0,0 +1,32 @@ +# Garage S3 API +server { + listen 80; + listen [::]:80; + server_name s3.hantim.net; + + location /.well-known/acme-challenge/ { + root /var/www/certbot; + } + + location / { + return 301 https://s3.hantim.net$request_uri; + } +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + http2 on; + server_name s3.hantim.net; + + ssl_certificate /etc/letsencrypt/live/s3.hantim.net/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/s3.hantim.net/privkey.pem; + + add_header Strict-Transport-Security "max-age=63072000; preload" always; + + client_max_body_size 100M; + + location / { + proxy_pass http://garage:3900; + } +} diff --git a/tools/new-app.sh b/tools/new-app.sh index e74258c..d5fc16b 100755 --- a/tools/new-app.sh +++ b/tools/new-app.sh @@ -159,7 +159,7 @@ HTTP_CODE=$(curl -s -o "$RESP" -w "%{http_code}" \ -X POST "$VULTR_API/domains/$APP/records" \ -H "$VULTR_AUTH" \ -H "Content-Type: application/json" \ - -d "{\"name\": \"\", \"type\": \"A\", \"data\": \"$SERVER_IP\", \"ttl\": 300}") + -d "{\"name\": \"\", \"type\": \"A\", \"data\": \"$SERVER_IP\", \"ttl\": 3600}") if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "201" ] && [ "$HTTP_CODE" != "204" ]; then echo "Error: Failed to create A record for $APP (HTTP $HTTP_CODE)" cat "$RESP" @@ -175,7 +175,7 @@ HTTP_CODE=$(curl -s -o "$RESP" -w "%{http_code}" \ -X POST "$VULTR_API/domains/$APP/records" \ -H "$VULTR_AUTH" \ -H "Content-Type: application/json" \ - -d "{\"name\": \"www\", \"type\": \"A\", \"data\": \"$SERVER_IP\", \"ttl\": 300}") + -d "{\"name\": \"www\", \"type\": \"A\", \"data\": \"$SERVER_IP\", \"ttl\": 3600}") if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "201" ] && [ "$HTTP_CODE" != "204" ]; then echo "Error: Failed to create A record for www.$APP (HTTP $HTTP_CODE)" cat "$RESP"