-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.stage.conf
52 lines (43 loc) · 1.36 KB
/
nginx.stage.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
upstream django_app {
server django:8000;
}
server {
listen 80;
server_name localhost;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name localhost;
server_tokens off;
# Stage cert's: (use stage certs)
# Certificate is set to expire 1 year after creation, if a new
# one is required, generate it with:
# $ env/staged-letsencrypt/live/localhost/generate-certs.sh
ssl_certificate /etc/letsencrypt/live/localhost/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/localhost/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://django_app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /srv/prod/static/;
}
location /app/ {
alias /srv/prod/frontend/dist/;
try_files $uri /index.html =404;
# FIXME: any invlaid files will serve index.html.
# This will be a problem when a user has a cached frontend;
# all .js, and .css files they request will have html content.
}
}