usergmr7
By:
usergmr7

Removing LetsEncrypt Nginx Ubuntu

November 12, 2016 129 views
Let's Encrypt 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?

1 comment
1 Answer

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:

  • 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.

Have another answer? Share your knowledge.