Django nginx普通的HTTP请求被发送到HTTPS端口

时间:2018-03-23 23:21:01

标签: django ssl nginx

当我去http://127.0.0.1:8000/时 400错误出现了 普通HTTP请求已发送到HTTPS端口

这是我的Django实例的nginx.conf是下面的代码。 这个错误的原因是什么?

upstream sweb {
ip_hash;
server sweb:8000;
}

server {
server_name oncms.ondemandkorea.com;
listen 80;

ssl_certificate /certs/development.crt;
ssl_certificate_key /certs/development.key;

ssl on;

location /static/ {
    autoindex on;
    alias /static/;
}

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass https://oncmsweb/;
}
}

0 个答案:

没有答案