簡體   English   中英

Nginx:刪除證書后 [emerg] 無法加載證書

[英]Nginx: [emerg] cannot load certificate after I deleted the certificate

我在我的一個子域上生成了 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命令沒有完全刪除證書什么的? 我現在不知道該怎么辦...

您可能使用了命令$ 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 / {
        ...
    }

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM