TypeError:SSLError(CertificateError(“主机名‘abc.com’与‘def.com’不匹配”,)

TypeError:SSLError(CertificateError(“主机名‘abc.com’与‘def.com’不匹配”,)

目前我正在使用一个django后端,它使另一个后端post request成为expressjs后端。我已经在开发服务器和本地机器上进行了测试,运行request完美。所以我将它推送到生产环境,但根本不起作用。

然后我看到这个错误很TypeError: SSLError(CertificateError("hostname 's.com' doesn't match 'f.com'",)奇怪。 虽然在f.com同一个但是它们的服务器块配置是分开的。 server instances.com

目前用于let's encrypt certbot这两个域。为什么会发生这种情况?无论如何,我可以进一步了解这是怎么发生的?

在此先感谢您的帮助。

在我的/etc/nginx/sites-available我有一个文件s.comf.com

以下f.com是我的配置

server {
    client_max_body_size 100M;
    listen 80;
    server_name f.com;

location / {
        proxy_pass http://localhost:3005;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    # try_files $uri $uri/ =404;
}

    listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/f.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/f.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


if ($scheme != "https") {
    return 301 https://$host$request_uri;
} # managed by Certbot

}

以下s.com是我的配置

server {
    listen 80;
    server_name s.com;

location / {
        proxy_pass http://localhost:3006;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    # try_files $uri $uri/ =404;
    # deny all;
}

    listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/s.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/s.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

# Redirect non-https traffic to https
if ($scheme != "https") {
    return 301 https://$host$request_uri;
} # managed by Certbot

}

相关内容