-
Notifications
You must be signed in to change notification settings - Fork 45
/
nginx.config
82 lines (70 loc) · 2.33 KB
/
nginx.config
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
# redirect all http requests to https
# and also listen on IPv6 addresses
server {
listen 80;
listen [::]:80;
server_name staging.healthlocker.uk;
return 301 https://$server_name$request_uri;
# let's encrypt *temporary*:
location ~ /.well-known {
root /var/www/html;
allow all;
}
}
#
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# the main server directive for ssl connections
# where we also use http2 (see asset delivery)
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name staging.healthlocker.uk;
ssl on;
# CORS
add_header Access-Control-Allow-Origin *;
# paths to certificate and key provided by Let's Encrypt
ssl_certificate /etc/letsencrypt/live/staging.healthlocker.uk/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/archive/staging.healthlocker.uk/privkey1.pem;
# SSL settings that currently offer good results in the SSL check
# and have a reasonable backwards-compatibility, taken from
# - https://cipherli.st/
# - https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
# security enhancements
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
# Let's Encrypt keeps its files here
location ~ /.well-known {
root /var/www/html;
allow all;
}
# besides referencing the extracted upstream this stays the same
location / {
include proxy_params;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_intercept_errors on;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Upgrade websocket;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 86400;
proxy_set_header Origin ''; # avoid 403 error see: https://git.io/v7frj
proxy_pass http://localhost:4000;
}
}