-
Notifications
You must be signed in to change notification settings - Fork 11
/
nginx.conf
90 lines (72 loc) · 2.47 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
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
# from: https://docs.gunicorn.org/en/latest/deploy.html
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# for UNIX domain socket setups
server unix:/tmp/gunicorn.sock fail_timeout=0;
# for a TCP configuration
# server 192.168.0.7:8000 fail_timeout=0;
}
server {
listen 80;
server_name testdrive.usecustos.org www.testdrive.usecustos.org;
return 301 https://testdrive.usecustos.org$request_uri;
}
server {
listen 8080;
root /usr/share/nginx/html;
location ~ ^/(css|js)/ {
# These assets include a digest in the filename, so they will never change
expires max;
}
location ~* ^.+\.(html|htm)$ {
# Very short caching time to ensure changes are immediately recognized
expires 5m;
}
# from: https://docs.gunicorn.org/en/latest/deploy.html
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://app_server;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/nginx/fullchain.pem;
ssl_certificate_key /etc/nginx/privkey.pem;
root /usr/share/nginx/html;
location ~ ^/(css|js)/ {
# These assets include a digest in the filename, so they will never change
expires max;
}
location ~* ^.+\.(html|htm)$ {
# Very short caching time to ensure changes are immediately recognized
expires 5m;
}
# from: https://docs.gunicorn.org/en/latest/deploy.html
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://app_server;
}
}