我有一个使用Django的网站。总是从我们的网站重定向为https。在localhost上它导致问题的问题。错误是:
**An error occurred during a connection to 127.0.0.1:8000. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG**
如何解决这个问题?拜托我需要你的帮忙。这个问题以前不存在。到目前为止我无法找到解决方案。
nginx配置为:
server {
listen 80;
listen [::]:80;
server_name www.website.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 6m;
if ($scheme = http) {
return 301 https://website.com$request_uri;
}
location /static {
alias /home/website/staticfiles;
autoindex on;
expires max;
gzip on;
gzip_types text/plain text/css application/json application/x-javascript text/xml
application/xml application/xml+rss text/javascript;
}
location /media {
alias /home/website/media;
autoindex on;
expires max;
}
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name IP website.com;
ssl_certificate /home/website/website.com.crt;
ssl_certificate_key /home/website/website.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers '';
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 6m;
location /static {
alias /home/website/staticfiles;
autoindex on;
expires max;
gzip on;
gzip_types text/plain text/css application/json application/x-javascript text/xml
application/xml application/xml+rss text/javascript;
}
location /media {
alias /home/website/media;
autoindex on;
expires max;
}
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}