Nginx:[emerg]删除证书后无法加载证书

ddhy6vgd  于 2023-03-29  发布在  Nginx
关注(0)|答案(2)|浏览(553)

我在我的一个子域上生成了一个SSL证书。然后我尝试使用certbot delete命令delete/revoke证书。弹出一个小终端菜单,询问我想要删除的证书。我删除了我想要删除的证书。现在,当运行sudo nginx -t时,我收到错误消息说:
nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/app.mydomain.nl/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory
我猜certbot delete命令没有完全删除证书什么的?我现在不知道该怎么做...

x6492ojm

x6492ojm1#

您可能使用了$ certbot --nginx命令,并编辑了nginx配置文件来查找证书:

server{
    server_name [your_domain];

    location /static {
        ...
    }

    location / {
        ...
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/[...]; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/[...]; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/[...]; # managed by Certbot

}

server{
    if ($host = [your_domain]) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    server_name [your_domain];
    listen 80;
    return 404; # managed by Certbot

}

$ certbot delete不会将其更改回来,因此您必须删除与证书相关的部分,并将server_name更改为您的IP地址,因此它看起来像:

server{
    server_name [your ip];

    location /static {
        ...
    }

    location / {
        ...
    }

}
ni65a41a

ni65a41a2#

注解或删除这些行

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/[...]; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/[...]; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/[...]; # managed by Certbot

/etc/nginx/sites-available中的所有可用文件中

相关问题