Repository navigation
Expand file tree
/
Copy pathsite.prod.conf
More file actions
78 lines (63 loc) · 1.75 KB
/
Copy pathsite.prod.conf
File metadata and controls
78 lines (63 loc) · 1.75 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
server {
listen *:80;
server_name default;
root /var/www/html/staticfiles;
index index.html;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location ~ \.php$ {
deny all;
}
location ~* \.(woff2|woff|ttf|otf|eot)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Access-Control-Allow-Origin "*";
access_log off;
}
# Static files with aggressive caching
location / {
try_files $uri @handler;
expires 30d;
add_header Cache-Control "public, immutable";
}
location @handler {
proxy_pass http://python:8001;
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 X-Forwarded-Proto $scheme;
proxy_read_timeout 300;
proxy_send_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
# Hide version info
proxy_hide_header X-Powered-By;
}
# Automatically check to see if an image theme override exists, then fall back to default
location ~/static/img/(.*)$ {
try_files /theme/img/$1 /img/$1;
expires 7d;
add_header Cache-Control "public";
}
location /static {
alias /var/www/html/staticfiles;
expires 7d;
add_header Cache-Control "public";
}
# JavaScript files with caching
location /js {
alias /var/www/html/staticfiles/js;
expires 7d;
add_header Cache-Control "public";
}
# Prevent django's 404 page from appearing on static assets
# Firefox freaks out when its expecting a .js file and it gets a django's html instead
location /widget/ {
try_files $uri =404;
}
# ELB health check endpoint (no logging to reduce noise)
location /health/ {
access_log off;
add_header Content-Type text/plain;
return 200 'ok';
}
}