-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnginx.conf
63 lines (53 loc) · 1.49 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
worker_processes auto;
error_log stderr warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
accept_mutex on;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
keepalive_timeout 5;
log_format main '[$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
server unix:/home/calitp/app/run/gunicorn.sock fail_timeout=0;
}
server {
listen 8000;
keepalive_timeout 65;
location /favicon.ico {
access_log off;
log_not_found off;
expires 1y;
add_header Cache-Control public;
}
# path for static files
location /static/ {
alias /home/calitp/app/static/;
expires 1y;
add_header Cache-Control public;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
# app path
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;
}
}
}