# nginx: serve the new front end at https://mams.nafith.om/v2/ (so the reCAPTCHA key registered for mams.nafith.om works). # # 1. build: npm run build:v2 (reads .env.v2, writes dist-v2/) # 2. copy: the CONTENTS of dist-v2/ to /var/www/mams-v2/v2/ (note the extra "v2" folder) # 3. add the block below INSIDE the existing `server { ... }` of mams.nafith.om, before any catch-all `location /` # 4. test and reload: sudo nginx -t && sudo systemctl reload nginx # # The new app calls the backend at the site root (/backend/core/controller.cfc, /index.cfm), exactly like the old one, so no # proxy rule is needed while the backend is on this same host. If the backend is on another host, see the second block. # --- the single-page app under /v2/ --- location ^~ /v2/ { root /var/www/mams-v2; # files live in /var/www/mams-v2/v2/ index index.html; try_files $uri $uri/ /v2/index.html; # any app route (/v2/e/TRUCKS/grid, /v2/caching …) serves index.html } # hashed assets never change: cache them for a year; index.html must never be cached location ^~ /v2/assets/ { root /var/www/mams-v2; add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } location = /v2/index.html { root /var/www/mams-v2; add_header Cache-Control "no-cache"; } # --- only if the backend is on ANOTHER host: forward /v2/api/ to it and build with VITE_API_BASE=/v2/api --- # location ^~ /v2/api/ { # proxy_pass https://mamsbe.nafith.om/; # proxy_ssl_server_name on; # proxy_set_header Host mamsbe.nafith.om; # proxy_cookie_domain mamsbe.nafith.om mams.nafith.om; # proxy_read_timeout 180s; # login and large exports can take 15 s or more # client_max_body_size 50m; # attachment uploads, the backend's own limit # }