/
ethercalc.org.conf
64 lines (58 loc) · 2 KB
/
ethercalc.org.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
upstream backend {
server 127.0.0.1:8080 max_fails=3;
server localhost:8080 max_fails=3;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
server_name ethercalc.org www.ethercalc.org localhost;
location / {
include /etc/nginx/cors.conf;
return 301 https://$server_name$request_uri;
}
}
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
proxy_temp_path /var/www/cache/tmp;
server {
listen 443 ssl spdy default_server;
large_client_header_buffers 32 64k;
root /usr/share/nginx/www;
index index.html index.htm;
ssl_certificate /var/www/ethercalc.org.crt;
ssl_certificate_key /var/www/ethercalc.org.pem;
server_name ethercalc.org www.ethercalc.org localhost;
location ~* (\.(css|png|gif|svg|ico|txt)|static/.*\.js(on)?|manifest\.(appcache|webapp|json)|browserconfig\.xml)$ {
root /var/www/ethercalc/;
expires 24h;
add_header Cache-Control public;
}
location ~* "(?:[.]|/_/[^/]+/)(?:html|csv|csv\.json)$" {
proxy_pass http://backend;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_read_timeout 31536000;
proxy_buffers 32 64k;
proxy_buffer_size 128k;
add_header Strict-Transport-Security max-age=31536000;
include /etc/nginx/cors.conf;
}
location / {
gzip on;
gzip_min_length 1000;
gzip_proxied any;
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_read_timeout 31536000;
proxy_set_header Connection $connection_upgrade;
# prevents 502 bad gateway error
proxy_buffers 32 64k;
proxy_buffer_size 128k;
add_header Strict-Transport-Security max-age=31536000;
include /etc/nginx/cors.conf;
}
}