From c40a1fda94d3757342b89b3df5baf53f77d4e8e3 Mon Sep 17 00:00:00 2001 From: Mohamed jameel alabasy Date: Sat, 2 May 2026 11:25:50 +0300 Subject: [PATCH] Serve SPA from static root instead of proxy Replace the previous proxy setup to a Vite dev server (port 5173) with static file serving from /var/www/rythmify. Adds root and index directives and an SPA fallback (try_files $uri $uri/ /index.html), and removes development-specific proxy and WebSocket/HMR headers and related comments. --- nginx/rythmify.duckdns.org.conf | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/nginx/rythmify.duckdns.org.conf b/nginx/rythmify.duckdns.org.conf index a29da77..1596af0 100644 --- a/nginx/rythmify.duckdns.org.conf +++ b/nginx/rythmify.duckdns.org.conf @@ -1,4 +1,3 @@ -# ── HTTP → HTTPS redirect ────────────────────────────────────────────────────── server { listen 80; listen [::]:80; @@ -7,12 +6,6 @@ server { return 301 https://$host$request_uri; } -# ── HTTPS — frontend (Vite dev server on port 5173) ─────────────────────────── -# -# The frontend is a React + Vite application. The Dockerfile runs: -# npm run dev -- --host 0.0.0.0 -# which starts the Vite dev server inside Docker, mapped to host port 5173. -# WebSocket upgrade headers are required for Vite HMR connections. server { listen 443 ssl; listen [::]:443 ssl; @@ -23,19 +16,10 @@ server { include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - location / { - proxy_pass http://localhost:5173; - proxy_http_version 1.1; - - # WebSocket upgrade — required for Vite HMR - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + root /var/www/rythmify; + index index.html; - 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; - - proxy_cache_bypass $http_upgrade; + location / { + try_files $uri $uri/ /index.html; } }