59 lines
2.3 KiB
Nginx Configuration File
59 lines
2.3 KiB
Nginx Configuration File
# TSE Monitor — sample nginx reverse-proxy configuration
|
|
#
|
|
# Place this file (or include it) in /etc/nginx/sites-available/tsemonitor
|
|
# then symlink: ln -s /etc/nginx/sites-available/tsemonitor /etc/nginx/sites-enabled/
|
|
# and reload: nginx -t && systemctl reload nginx
|
|
|
|
server {
|
|
listen 80;
|
|
server_name monitor.example.com; # ← change to your domain or IP
|
|
|
|
# Optional: redirect HTTP → HTTPS (uncomment when TLS is configured)
|
|
# return 301 https://$host$request_uri;
|
|
|
|
# Vite HMR WebSocket (dev mode only — remove in production)
|
|
location /vite-hmr {
|
|
proxy_pass http://127.0.0.1:20080;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# All traffic → monitor.js (Express + Vite middleware on port 20080)
|
|
location / {
|
|
proxy_pass http://127.0.0.1:20080;
|
|
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;
|
|
|
|
# Timeouts — aggregation backfill can take a moment on startup
|
|
proxy_read_timeout 30s;
|
|
proxy_send_timeout 30s;
|
|
}
|
|
}
|
|
|
|
# ── TLS (HTTPS) ──────────────────────────────────────────────────────────────
|
|
# Uncomment after running: certbot --nginx -d monitor.example.com
|
|
#
|
|
# server {
|
|
# listen 443 ssl http2;
|
|
# server_name monitor.example.com;
|
|
#
|
|
# ssl_certificate /etc/letsencrypt/live/monitor.example.com/fullchain.pem;
|
|
# ssl_certificate_key /etc/letsencrypt/live/monitor.example.com/privkey.pem;
|
|
# include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
#
|
|
# location / {
|
|
# proxy_pass http://127.0.0.1:20080;
|
|
# 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;
|
|
# }
|
|
# }
|