diff --git a/docs/CADDY_CONFIG.md b/docs/CADDY_CONFIG.md index ef18bdf..ffbf985 100644 --- a/docs/CADDY_CONFIG.md +++ b/docs/CADDY_CONFIG.md @@ -6,12 +6,17 @@ Add this to `/etc/caddy/Caddyfile` on the Caddy VM (192.168.10.74): ```caddyfile -# Main POS domain +# Landing page / Dashboard nexusautoparts.com.mx, www.nexusautoparts.com.mx { reverse_proxy 192.168.10.91:80 } -# Admin dashboard subdomain +# POS (point of sale app) +pos.nexusautoparts.com.mx { + reverse_proxy 192.168.10.91:80 +} + +# Dashboard admin (optional alternative access) admin.nexusautoparts.com.mx { reverse_proxy 192.168.10.91:80 } @@ -30,3 +35,12 @@ sudo caddy reload --config /etc/caddy/Caddyfile ``` Caddy will automatically obtain Let's Encrypt certificates for all domains. + +## DNS Records needed in Hostinger + +| Record | Name | Target | +|---|---|---| +| A | @ | IP of Caddy VM | +| CNAME | www | nexusautoparts.com.mx | +| CNAME | pos | nexusautoparts.com.mx | +| CNAME | admin | nexusautoparts.com.mx | diff --git a/nginx/nexus-pos.conf b/nginx/nexus-pos.conf index 300ad20..981fd5b 100644 --- a/nginx/nexus-pos.conf +++ b/nginx/nexus-pos.conf @@ -10,7 +10,7 @@ upstream nexus_quart { server 127.0.0.1:5002; } -# ─── POS (primary domain) ─── +# ─── Landing page / Dashboard (primary domain) ─── server { listen 80; server_name nexusautoparts.com.mx www.nexusautoparts.com.mx; @@ -24,6 +24,30 @@ server { gzip_comp_level 6; gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; + location / { + proxy_pass http://nexus_dashboard; + 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_read_timeout 300s; + } +} + +# ─── POS (dedicated subdomain) ─── +server { + listen 80; + server_name pos.nexusautoparts.com.mx; + + client_max_body_size 10M; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; + # Static assets with caching (proxy to Flask) location /pos/static/ { proxy_pass http://nexus_pos; @@ -63,7 +87,7 @@ server { } } -# ─── Dashboard (admin subdomain) ─── +# ─── Dashboard admin (alternative access) ─── server { listen 80; server_name admin.nexusautoparts.com.mx; diff --git a/pos/capacitor.config.json b/pos/capacitor.config.json index add5e5c..1a44c98 100644 --- a/pos/capacitor.config.json +++ b/pos/capacitor.config.json @@ -3,7 +3,7 @@ "appName": "Nexus POS", "webDir": "www", "server": { - "url": "https://nexusautoparts.com.mx/pos", + "url": "https://pos.nexusautoparts.com.mx/pos", "cleartext": true }, "plugins": { diff --git a/pos/mobile/README.md b/pos/mobile/README.md index 40f8821..54cfbf5 100644 --- a/pos/mobile/README.md +++ b/pos/mobile/README.md @@ -8,7 +8,7 @@ ## Architecture The Capacitor app loads the POS from the remote server at -`https://nexusautoparts.com.mx/pos`. This means: +`https://pos.nexusautoparts.com.mx/pos`. This means: - The app requires internet on first load. - The PWA service worker handles offline caching after that. - No HTML/JS/CSS is bundled into the native binary.