Nginx находится на том же узле что и django-сервер
nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream django {
least_conn;
server 127.0.0.1:8000;
}
server {
listen 80;
server_name http_server;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name https_server;
ssl_certificate /etc/nginx/certs/solomka.cloud.crt;
ssl_certificate_key /etc/nginx/certs/device.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://django;
proxy_set_header Host $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;
}
}
}