- Add /carmode URL that auto-enters car mode without exit option - /carmode uses its own API route (/carmode/api/) for isolation - Hide exit button and disable Escape key on /carmode - Skip lock screen on dedicated car mode URL - Replace macOS/Ubuntu docs with nginx configuration guide Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
89 lines
2.3 KiB
Plaintext
89 lines
2.3 KiB
Plaintext
Nginx Configuration for Car News App
|
|
=====================================
|
|
|
|
This app requires two route groups in your nginx server block:
|
|
|
|
1. /carnews/ - Full news app with regular and car mode views
|
|
2. /carmode/ - Standalone car mode display (no exit, no links to main app)
|
|
|
|
Both routes share the same backend API server (port 5555) and static files.
|
|
|
|
|
|
NGINX CONFIGURATION
|
|
-------------------
|
|
|
|
Add the following to your server block:
|
|
|
|
# --- Car News App ---
|
|
location = /carnews {
|
|
return 301 /carnews/;
|
|
}
|
|
|
|
location /carnews/api/ {
|
|
proxy_pass http://127.0.0.1:5555/api/;
|
|
proxy_http_version 1.1;
|
|
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 180s;
|
|
proxy_connect_timeout 180s;
|
|
proxy_send_timeout 180s;
|
|
}
|
|
|
|
location /carnews/ {
|
|
alias /var/www/news-feed-car-mode/news-app/dist/;
|
|
index index.html;
|
|
try_files $uri $uri/ /carnews/index.html;
|
|
}
|
|
|
|
# --- Car Mode Direct Access ---
|
|
location = /carmode {
|
|
return 301 /carmode/;
|
|
}
|
|
|
|
location /carmode/api/ {
|
|
proxy_pass http://127.0.0.1:5555/api/;
|
|
proxy_http_version 1.1;
|
|
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 180s;
|
|
proxy_connect_timeout 180s;
|
|
proxy_send_timeout 180s;
|
|
}
|
|
|
|
location /carmode/ {
|
|
alias /var/www/news-feed-car-mode/news-app/dist/;
|
|
index index.html;
|
|
try_files $uri $uri/ /carmode/index.html;
|
|
}
|
|
|
|
|
|
CONFIGURATION NOTES
|
|
-------------------
|
|
|
|
- The API timeout is set to 180s because AI grouping requests can take time
|
|
- Both /carnews/ and /carmode/ serve the same dist/ folder
|
|
- The frontend JS detects which URL it's on and adjusts behavior accordingly
|
|
- proxy_http_version 1.1 is required for proper keep-alive connections
|
|
|
|
|
|
AFTER CHANGES
|
|
-------------
|
|
|
|
Test and reload nginx:
|
|
|
|
sudo nginx -t
|
|
sudo systemctl reload nginx
|
|
|
|
|
|
BUILDING THE APP
|
|
----------------
|
|
|
|
After code changes, rebuild the frontend:
|
|
|
|
cd /var/www/news-feed-car-mode/news-app
|
|
npm run build
|