-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy pathnginx.template.conf
More file actions
113 lines (97 loc) · 3.5 KB
/
nginx.template.conf
File metadata and controls
113 lines (97 loc) · 3.5 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
events{}
http {
include /etc/nginx/mime.types;
# Security
client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE};
client_body_buffer_size 1K;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
add_header X-Frame-Options "SAMEORIGIN";
add_header Referrer-Policy "no-referrer-when-downgrade";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";
ssi off;
server_tokens off;
# Cache expiration
map $sent_http_content_type $expires {
# Default: Fallback
default 1M;
# Default: No content
"" off;
~*image/svg\+xml 5d;
~*text/html epoch;
~*json epoch;
~*application/javascript 1M;
~*text/css 1M;
}
expires $expires;
add_header Cache-Control "public, max-age=$expires";
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
gzip on;
gzip_types
text/plain
text/css
application/json
application/javascript
image/svg+xml;
gzip_comp_level 5;
gzip_proxied any;
gzip_min_length 256;
gzip_vary on;
location /socket.io {
proxy_pass http://localhost:3000/socket.io;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location ^~ /api/v1/openapi/static/ {
proxy_pass http://localhost:3000/v1/openapi/static/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location /api/ {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
# --- AI Streaming-specific settings ---
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding on;
}
location ~ ^/api/v1/webhooks/[^/]+/sync$ {
rewrite ^/api(/v1/webhooks/[^/]+/sync)$ $1 break;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_connect_timeout ${NGINX_WEBHOOK_SYNC_TIMEOUT};
proxy_send_timeout ${NGINX_WEBHOOK_SYNC_TIMEOUT};
proxy_read_timeout ${NGINX_WEBHOOK_SYNC_TIMEOUT};
send_timeout ${NGINX_WEBHOOK_SYNC_TIMEOUT};
}
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
root /usr/share/nginx/html;
add_header Expires "0";
add_header Cache-Control "public, max-age=31536000, immutable";
}
# USe the default language for the root of the application
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html?$args;
}
}
}