Bobcares

certbot NGINX delete certificate

by | Jan 6, 2023

Wondering how to perform certbot NGINX delete certificate? Our Server Management Support team is here to lend a hand with your queries and issues.

certbot NGINX delete certificate

Today, let us see the steps followed by our support techs to remove certot.

Step1: Specify the domain name

mydomain=apps.example.com

Step2: Remove an nginx Config from Sites-Enabled

# Remove the domain config files
cd /etc/nginx
sudo rm sites-available/$mydomain
sudo rm sites-enabled/$mydomain

# Check whether nginx has valid configurations and then reload the service
sudo nginx -t  
sudo service nginx restart 

Step3: Finally, remove certificate for a domain

# Show the list of certificates
certbot certificates

# Remove certificates for a given domain
sudo certbot delete --cert-name $mydomain

Make sure you clean out your browser cache.

Browsers remember which protocol it used first time, and will use it every next time until some point. To make it see changes now – clean cache.

If that doesn’t help, check your nginx config. Let’s say before removing you had this Server blocks:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com www.example.com;
    return 301 https://$server_name$request_uri;
}

server {

    # SSL configuration

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/ssl-example.com.conf;
    include snippets/ssl-params.conf;

    root /var/www/html;
    
    server_name example.com www.example.com;
    ...
    location / {
        ...
    }
    location ~ /.well-known {
                allow all;
    }
    ...
}

What you need to do, remove first server block, one which is listening on port 80. In second one which listens on port 443 do the following:

  • Change listen 443 ssl http2 default_server; to listen 80 default_server;.
  • Change listen [::]:443 ssl http2 default_server; to listen [::]:80 default_server;.
  • Remove next two include directives.
  • You can remove location ~ /.well-known too. After this changes, you have something like this:
server {

    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    
    server_name example.com www.example.com;
    ...
    location / {
        ...
    }
    ...
}

Save changes and run nginx to make sure everything is correct:

sudo nginx -t

If everything is OK, restart nginx to make changes in effect:

sudo systemctl restart nginx

Clean browser cache once again, try another browser or use Incognito mode and try to access site.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

To conclude, our Support Engineers demonstrated steps to remove certbot NGINX.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.