Question

Removing LetsEncrypt Nginx Ubuntu

Hi

So I followed this guide : https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-in-ubuntu-16-04

Everything was working fine, but now I’ve decided to not use https anymore and have reverted most of the changes I followed but my site now refuses to load, it still tries to redirect me to a https version?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Make sure you cleaned 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:

  1. sudo nginx -t

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

  1. sudo systemctl restart nginx

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