Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
82 lines (70 loc) · 2.67 KB
/
Copy pathnginx.conf
File metadata and controls
82 lines (70 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ==============================================================================
# PyTransDatRO - Production Nginx Configuration
# Reverse Proxy & Static Web Application Server
# ==============================================================================
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Performance optimizations
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
# Compression for static webapp assets
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/x-javascript
text/xml
application/xml
application/xml+rss
image/svg+xml;
server {
listen 80;
server_name localhost;
# Allow large file transformations up to 50MB (matches PYTRANSDAT_MAX_FILE_UPLOAD_BYTES)
client_max_body_size 50M;
# Root directory for compiled Vite frontend
root /usr/share/nginx/html;
index index.html;
# --------------------------------------------------------------------------
# Web Application Frontend (SPA routing)
# --------------------------------------------------------------------------
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets with content hashes aggressively (1 year)
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|spg)$ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# --------------------------------------------------------------------------
# Backend API Reverse Proxy with Client IP Preservation
# --------------------------------------------------------------------------
location ~ ^/(api|docs|redoc|openapi.json|health|transdatonline) {
proxy_pass http://backend:8000;
proxy_http_version 1.1;
# Essential headers for rate limiting and HTTPS detection
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;
# Support streaming file conversions and long-running batch requests
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
proxy_buffering off;
}
}
}