1 server {
2 server_name domen;
3
4 location /.well-known {
5 root /var/www/html;
6 }
7
8 location = /favicon.ico {
9 root /home/ubuntu/awtoyuwalga/djangowebsite;
10 }
11 location /static/ {
12 root /home/ubuntu/awtoyuwalga/djangowebsite;
13 }
14 location /media/ {
15 root /home/ubuntu/awtoyuwalga/djangowebsite;
16 }
17 location / {
18 set_real_ip_from 10.0.0.0/8;
19 proxy_set_header X-Real-IP $remote_addr;
20 proxy_set_header X-Forwarded-Host $server_name;
21 proxy_pass http://127.0.0.1:8001;
22 add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV
23 add_header Access-Control-Allow-Origin *;
24 }
25
26
27 listen 443 ssl; # managed by Certbot
28 ssl_certificate /etc/letsencrypt/live/www.domen.domen/fullchain.pe
29 ssl_certificate_key /etc/letsencrypt/live/www.domen.domen/privkey.
30 include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
31 ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
32
33 }
34 server {
35 if ($host = domen){
36 return 301 https://$host$request_uri;
37 } # managed by Certbot
38
39 server_name domen;
40 listen 80;
41 return 404; # managed by Certbot
42 }
43