# insight.conf — Managed by Ansible (INSIGHT-Infra) # Reverse Proxy: WEB01 → APS01 upstream insight_api { server {{ aps01_ip | default('172.20.10.21') }}:3000; keepalive 32; } server { listen 80; server_name {{ nginx_server_name | default('_') }}; # React SPA (Static Files) root {{ nginx_webroot | default('/var/www/insight') }}; index index.html; # API Proxy → APS01 location /api/ { proxy_pass http://insight_api; proxy_http_version 1.1; proxy_set_header Connection ""; 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_connect_timeout 30s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_buffer_size 4k; proxy_buffers 8 4k; } # WebSocket (für NestJS Events / Pub-Sub) location /socket.io/ { proxy_pass http://insight_api; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # React SPA Fallback (client-side routing) location / { try_files $uri $uri/ /index.html; # Cache Static Assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } } # Health Check location /health { access_log off; return 200 "OK\n"; add_header Content-Type text/plain; } }