skip to Main Content

I generated an SSL certificate on one of my subdomains. I then tried to delete/revoke the certificate using the command certbot delete. A little terminal menu popped up asking me what certificate I would like to delete. I deleted the one I wanted to delete. Now, when running sudo nginx -t I am getting error messages saying:

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

I guess the certbot delete command did not fully delete the certificate or something? I am clueless what to do right now…

2

Answers


  1. You probably used the command $ certbot --nginx and your nginx config file was edited to look for the certificate:

    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
    
    }
    

    The $ certbot delete will not change it back, so you have to delete the part related to the certificated and change the server_name to your ip address, so it will look like:

    server{
        server_name [your ip];
    
        location /static {
            ...
        }
    
        location / {
            ...
        }
    
    }
    
    Login or Signup to reply.
  2. Comment or remove these lines

    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
    

    in all files available in /etc/nginx/sites-available

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search