Я пытаюсь отправить электронное письмо, используя функцию django send_mail gmail SMTP на моем веб-сервере, и я получил ошибку 502 Bad Gateway.
Я использую nginx и gunicorn.
Вот мой error.log:
2014/04/12 16:46:55 [error] 26846#0: *11 upstream prematurely closed connection while
reading response header from upstream, client: 179.162.163.62, server: example.com,
request: "POST /contact/ HTTP/1.1", upstream: "http://127.0.0.1:9000/contact/", host:
"example.com", referrer: "http://example.com/contact/"
Ngnix-файл:
upstream example_gunicorn {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server_name .example.com;
keepalive_timeout 5;
location /static/ {
alias /deploy/sites/example/static/; # STATIC_ROOT
expires 30d;
}
location /media/ {
alias /deploy/sites/example/media/; # MEDIA_ROOT
expires 30d;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://example_gunicorn;
}
}