Django nginx gunicorn как они связаны между собой?
Я хочу развернуть свое приложение django на сервере linux. Для этого я использую
gunicorn (version 20.1.0)
nginx/1.18.0
Django==3.0.5
sites-available/bunn_nginx.conf
upstream django {
server unix:///home/app/bunn/auth/auth.sock;
}
server {
server_name example.com www.example.com;
# max upload size
client_max_body_size 75M;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/app/bunn/auth/static/;
}
location / {
include proxy_params;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_pass http://unix:/home/app/bunn/auth/auth.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/thermal.d-d-s.dk/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.com;
return 404; # managed by Certbot
}
uwsgi.ini
[uwsgi]
# full path to Django project's root directory
chdir = /home/app/bunny/auth/
# Django's wsgi file
module = auth.wsgi
# full path to python virtual env
home = /home/app/bunny/env/
# enable uwsgi master process
master = true
# buffer size
buffer-size = 72000
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /home/app/bunny/auth/auth.sock
# socket permissions
chmod-socket = 666
# clear environment on exit
vacuum = true
app@debian-2gb-fsn1-1:~$
Я не могу получить доступ к своему серверу из доменного имени. Я получаю 502 Bad Gateway
при доступе к example.com
/var/log/nginx/error.log
2021/08/26 10:54:04 [error] 18067#18067: *88 upstream prematurely closed connection while reading response header from upstream, client: ***********, server: example.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/app/bunn/auth/auth.sock:/", host: "example.com"