forked from trr266/otree_docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
otree5_nginx_site.conf
50 lines (41 loc) · 1.39 KB
/
otree5_nginx_site.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
# The below is a working sites configuration for nginx to reverse
# proxy a local container with a non standard port to
# a dedicated subdomain using HTTPS and letsencrypt
# Use at your own risk
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
server_name subdomain.xyz.org;
root /var/www/html/otree5;
error_log /var/log/nginx/otree5_debug debug;
access_log /var/log/nginx/otree5_access.log;
location ~ /\.ht {
deny all;
}
# From https://otree-server-setup.readthedocs.io/en/latest/step5.html
location / {
proxy_pass http://localhost:1234; # adjust port
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
ssl_certificate /etc/letsencrypt/live/subdomain.xyz.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain.xyz.org/privkey.pem; # managed by Certbot
}
server {
if ($host = subdomain.xyz.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain.xyz.org;
return 404; # managed by Certbot
}