django-nginx-“错误:太多提示”

时间:2018-07-26 21:54:11

标签: django nginx django-channels django-2.0

我的nginx配置有问题。 我收到错误ERR: TOO MANY REDIRECTS

如果我将var SECURE_SSL_REDIRECT = True更改为False,该错误消失了,但是我认为这是导致我的频道设置出现问题的原因,我的websocket无法完成握手。

我找到了这个link,我认为这是我的问题,但我不知道如何解决。 我尝试将proxy_pass http://unix...更改为https://unix...,这将导致重定向停止,但页面无法加载。

server {
    server_name myproject.com;

location = /favicon.ico { access_log off; log_not_found off; }

location /static/ {
    alias /home/xx/myproject/static/;
}

location /static/admin/ {
    alias /home/xx/myproject/static/admin/;
}

location /media/ {
    alias /home/xx/myproject/media/;
}

location / {
    include proxy_params;
    proxy_pass http://unix:/home/xx/myproject/myproject.sock;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/myproject.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/myproject.com/privkey.pem; # managed by Certb$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = myproject.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


listen 80;
server_name myproject.com;
return 404; # managed by Certbot


}

0 个答案:

没有答案