-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmywebserver.conf
51 lines (42 loc) · 1.27 KB
/
mywebserver.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
upstream app_server {
server localhost:8000;
}
# Redirect all traffic to https
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mywebserver.com;
# INCLUDE GZIP SETTINGS
# SSL SETTINGS
ssl_certificate /etc/letsencrypt/live/divesandybeach.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/divesandybeach.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
ssl_protocols TLSv1.3;
# DJANGO MEDIA FILES
location /media {
proxy_cache_valid any 1m;
proxy_cache_min_uses 3;
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
alias /home/ubuntu/divesandybeach/media_root;
}
# DJANGO STATIC FILES
location /static {
gzip_static on;
proxy_cache_valid any 1m;
proxy_cache_min_uses 3;
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
alias /home/ubuntu/divesandybeach/static_root;
}
# FORWARD TO DJANGO SERVER
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}