Django Can';t使用LetsEncrypt证书连接到网站-nginx

Django Can';t使用LetsEncrypt证书连接到网站-nginx,django,nginx,ssl-certificate,lets-encrypt,Django,Nginx,Ssl Certificate,Lets Encrypt,我想将ssl证书添加到我的django应用程序中。我已经这样做了,所以域的nginx配置已更改,但现在看来生成的证书不正确 certbot修改前的nginx conf server { listen 80; listen [::]:80; server_name doamin.com www.domain.com; location = /favicon.ico { access_log off; log_not_found off; } locati

我想将ssl证书添加到我的django应用程序中。我已经这样做了,所以域的nginx配置已更改,但现在看来生成的证书不正确

certbot修改前的nginx conf

server {
    listen 80;
    listen [::]:80;
    server_name doamin.com www.domain.com;


    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/poul3r/doamin.com;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }
}
在certbot行动之后

server {
    server_name doamin.com www.doamin.com;


    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/poul3r/doamin.com;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }



    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/doamin.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/doamin.com/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 = doamin.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    listen [::]:80;
    server_name doamin.com www.doamin.com;
    return 404; # managed by Certbot
}

在letsencypt实现过程中,我做错了什么,或者可能出了什么问题?

我已经找到了解决这个问题的方法。根据我了解到的信息,nginx上还有一个应用程序没有ssl认证,但重定向到443。当我将他们的配置更改为仅在80上侦听时,第一个域工作正常

我已经找到了这个问题的解决方案。根据我了解到的信息,nginx上还有一个应用程序没有ssl认证,但重定向到443。当我将他们的配置更改为仅在80上侦听时,第一个域工作正常

您在nginx日志(错误和访问日志)中看到了什么?nginx错误日志文件中的@dirkgroten日志看起来像“[error]15715#15715:*73 ssl握手时在服务器侦听ssl端口时未定义“ssl_证书”,客户端:X.X.X.X,服务器:0.0.0.0:443”(X.X.X.X-我的计算机ip)。这是什么意思?“/etc/letsencrypt/live/doamin.com/fullchain.pem”路径后面有一个密钥文件。所有证书文件都是生成和存在的。您在nginx日志(错误和访问日志)中看到了什么?nginx错误日志文件中的dirkgroten日志看起来像“[error]15715#15715:*73在ssl握手时在服务器侦听ssl端口时未定义“ssl_证书”,客户端:X.X.X.X,服务器:0.0.0:443”(X.X.X.X-我的计算机ip)。这是什么意思?“/etc/letsencrypt/live/doamin.com/fullchain.pem”路径后面有一个密钥文件。生成并存在的所有证书文件。