From 9ac57684f03630c079e2a09aa5dd5d4963fa7815 Mon Sep 17 00:00:00 2001 From: Jonathan DeMasi Date: Fri, 6 Feb 2026 22:05:24 -0700 Subject: [PATCH] add static site support --- .../nginx/tasks/templates/vhost_ssl.conf.j2 | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/ansible/roles/nginx/tasks/templates/vhost_ssl.conf.j2 b/ansible/roles/nginx/tasks/templates/vhost_ssl.conf.j2 index e2543c1..63fddb0 100644 --- a/ansible/roles/nginx/tasks/templates/vhost_ssl.conf.j2 +++ b/ansible/roles/nginx/tasks/templates/vhost_ssl.conf.j2 @@ -33,14 +33,24 @@ server { ssl_stapling_verify on; server_name {{ inventory_hostname }}; - location / { - client_max_body_size 512M; - proxy_pass http://localhost:3000; - proxy_set_header Connection $http_connection; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } + {% if not static_site %} + location / { + client_max_body_size 512M; + proxy_pass http://localhost:3000; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + {% endif %} + {% if static_site %} + root /srv/http/{{ inventory_hostname }}/html; + index index.html; + error_page 404 /404.html; + location / { + try_files $uri $uri.html $uri/ =404; + } + {% endif %} }