-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
106 lines (91 loc) · 3.33 KB
/
nginx.conf
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
include redirect-map.conf;
server {
server_name data.caltech.edu
add_header Strict-Transport-Security "max-age=15768000"; # 6 months
# Request ID tracing (allows end-to-end tracking of requests for better
# troubleshooting)
add_header X-Request-ID $request_id;
# The request body is sent to the proxied server immediately as it is
# received
proxy_request_buffering off;
# Sets the HTTP protocol v1.1 for proxying in order to not use the buffer
# in case of chunked transfer encoding
proxy_http_version 1.1;
# Proxying to the application server
## UI server
location / {
uwsgi_pass 127.0.0.1:5000;
include uwsgi_params;
uwsgi_buffering off;
uwsgi_request_buffering off;
uwsgi_param Host $host;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $scheme;
# Pass request id to the ui server
uwsgi_param X-Request-ID $request_id;
# X-Session-ID / X-User-ID is read by nginx and included in the logs,
# however we don't want to expose them to clients so we are hiding them.
uwsgi_hide_header X-Session-ID;
uwsgi_hide_header X-User-ID;
# Max upload size (except for files) is set to 100mb as default.
client_max_body_size 100m;
}
## Most API
location /api {
uwsgi_pass 127.0.0.1:5001;
include uwsgi_params;
uwsgi_buffering off;
uwsgi_request_buffering off;
uwsgi_param Host $host;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $scheme;
# Pass request id to the api server
uwsgi_param X-Request-ID $request_id;
# X-Session-ID / X-User-ID is read by nginx and included in the logs,
# however we don't want to expose them to clients so we are hiding them.
uwsgi_hide_header X-Session-ID;
uwsgi_hide_header X-User-ID;
# Max upload size (except for files) is set to 100mb as default.
client_max_body_size 100m;
}
## API files
# Another location is defined in order to allow large file uploads in the files
# API without exposing the other parts of the application to receive huge
# request bodies.
location ~ /api/records/.+/draft/files/.+/content {
gzip off;
uwsgi_pass 127.0.0.1:5001;
include uwsgi_params;
uwsgi_buffering off;
uwsgi_request_buffering off;
uwsgi_param Host $host;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param X-Forwarded-Proto $scheme;
# Pass request id to api server
uwsgi_param X-Request-ID $request_id;
# X-Session-ID / X-User-ID is read by nginx and included in the logs,
# however we don't want to expose them to clients so we are hiding them.
uwsgi_hide_header X-Session-ID;
uwsgi_hide_header X-User-ID;
# Max upload size for files is set to 500GB (configure as needed).
client_max_body_size 500G;
}
# Static content is served directly by nginx and not the application server.
#location /static {
# alias /opt/invenio/var/instance/static;
# autoindex off;
#}
#Redirect old urls from redirect-map
if ( $redirect_uri ) {
return 301 $redirect_uri;
}
}
server {
if ($host = data.caltech.edu) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name data.caltech.edu
add_header Strict-Transport-Security "max-age=15768000";
listen 80;
return 404; # managed by Certbot
}