66 lines
1.9 KiB
Nginx Configuration File
66 lines
1.9 KiB
Nginx Configuration File
worker_processes 1;
|
|
pid /run/nginx.pid;
|
|
error_log /var/log/nginx/error.log warn;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
sendfile on;
|
|
keepalive_timeout 65;
|
|
client_max_body_size 100m; # upload endpoint accepts up to 50MB per file, several at once
|
|
access_log /var/log/nginx/access.log;
|
|
|
|
upstream flask_backend {
|
|
server 127.0.0.1:5001;
|
|
keepalive 8;
|
|
}
|
|
|
|
server {
|
|
listen 3000 default_server;
|
|
server_name _;
|
|
|
|
root /app/frontend/dist;
|
|
index index.html;
|
|
|
|
# Long timeouts: backend's ontology/profile/report generation can take minutes
|
|
proxy_connect_timeout 600s;
|
|
proxy_send_timeout 600s;
|
|
proxy_read_timeout 600s;
|
|
send_timeout 600s;
|
|
|
|
# Reverse-proxy /api/* and /health to Flask
|
|
location /api/ {
|
|
proxy_pass http://flask_backend/api/;
|
|
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_buffering off; # important for SSE / streamed responses
|
|
}
|
|
|
|
location = /health {
|
|
proxy_pass http://flask_backend/health;
|
|
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;
|
|
}
|
|
|
|
# Vite emits /assets/<hash>.<ext> for JS/CSS; let nginx serve with proper mime
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# SPA fallback: send everything else to index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
}
|