forked from climsoft/climsoft-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
89 lines (76 loc) · 3.2 KB
/
nginx.conf
File metadata and controls
89 lines (76 loc) · 3.2 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
events {}
http {
# HTTP Server Block
server {
listen 80;
# Allow requests from any domain/IP address
server_name _;
client_max_body_size 1g; # allow uploads upto a maximum of 1GB. Note API allows body size of 1MB and multipart of 1GB for observations uploads
client_body_timeout 300s; # Timeout for reading client request body (5 minutes due to potential slow connections and large file size)
#client_header_timeout 300s; # Timeout for reading client request header (5 minutes due to potential slow connections)
#------------------------------------
# # Enable this block when you want to use https
# location / {
# return 301 https://$host$request_uri;
# }
#------------------------------------
#Disable this block when you don't want to use http
# Serve Angular (PWA) Requests
location / {
proxy_pass http://climsoft_pwa:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Try Angular paths
proxy_intercept_errors on;
error_page 404 = @angular_fallback;
}
# Proxy API Requests to NestJS
location /api/ {
proxy_pass http://climsoft_api:3000/;
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 Origin $http_origin; # Forward the Origin header. TODO this is not forwarded to NestJS yet, so investigate why.
# Large upload settings
proxy_connect_timeout 300s; # just incase api server is overloaded and slow to accept new connections (especially when sending multiple large files to it)
proxy_send_timeout 300s; # A 1GB file being streamed, it might take more than 60s to transmit
proxy_read_timeout 300s; # API might take more than 60s to process a large file (e.g duckdb processing and saving to db )
proxy_request_buffering off; # Switch off because for large uploads TO backend
proxy_buffering off; # Stream directly from the API
}
location @angular_fallback {
proxy_pass http://climsoft_pwa:80;
rewrite ^ /index.html break;
}
#------------------------------------
}
#------------------------------------
# Enable this block when you want to use https
# HTTPS Server Block
# server {
# listen 443 ssl;
# server_name localhost;
# # SSL Certificate Files
# #ssl_certificate /etc/nginx/certs/fullchain.pem;
# #ssl_certificate_key /etc/nginx/certs/privkey.pem;
# # SSL Protocols and Ciphers
# #ssl_protocols TLSv1.2 TLSv1.3;
# #ssl_ciphers HIGH:!aNULL:!MD5;
# # Serve Angular (PWA) Requests
# location / {
# proxy_pass http://climsoft_pwa:80;
# 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 API Requests to NestJS
# location /api/ {
# proxy_pass http://climsoft_api:3000/;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# }
# }
#------------------------------------
}