learninglogs_user

A+ на SSllabs.com

 

Конфигурация Nginx

/etc/nginx/conf.d/sitename.ru.conf 
 

server {
    listen 80;
    server_name www.sitename.ru sitename.ru;
# Принудительное перенаправление на https
    return 301 https://sitename.ru$request_uri;
}
server {
    server_name www.sitename.ru sitename.ru;

    listen 443 ssl http2;

    ssl_certificate /etc/letsencrypt/live/sitename.ru/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/sitename.ru/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/sitename.ru/chain.pem;

    add_header Strict-Transport-Security "max-age=31536000";

    ssl_protocols     TLSv1.2 TLSv1.3;
    ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDS>    

    ssl_dhparam /etc/ssl/dhparams2048.pem;
    ssl_session_cache   shared:SSL:10m;
    ssl_stapling on;
    ssl_prefer_server_ciphers on;
    ssl_session_tickets off;
    ssl_session_timeout 1d;

    ssl_stapling_verify on;
    resolver 8.8.8.8 8.8.4.4 valid=300s;
    Header set Strict-Transport-Security "max-age=31536000" env=HTTPS


    location /static/ {
        root /home/username/your_project_dir/manage.py dir/;
    }

    location /media/ {
        root /home/username/your_project_dir/manage.py dir/;
    }


    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:8000;
    }
}