Beginner- redirect to https


#1

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: level123.uk

Hello
I am sorry if this question is very common but I haven’t found an answer by web searching or in the Let’s Encrypt documentation. I have followed instructions at . When I had the option:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

I selected 2 and get 404 when I enter https://level123.uk So as a first step I’d like to follow the advice “You can undo this change by editing your web server’s configuration.” but I cannot find instructions on what I should change.

Many thanks for any help.

My web server is (include version): nginx 1.14.0

The operating system my web server runs on is (include version): ubuntu 18.04

My hosting provider, if applicable, is: Digital Ocean

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no


#2

In one or more of your /etc/nginx/ files, you should find some Certbot-managed code that approximately resembles:

if ($host == 'level123.co.uk') {
    return 301 https://$host$request_uri;
}

You can more or less just remove these three lines to get rid of the redirect, and reload nginx.

Keep in mind that your browser will probably remember the redirect anyway, even if you make this change. For that, you will need to clear your browser’s cache or do a hard refresh.


#3

Selecting 2 creates a redirection in the http block.
Your link is directed at https (which should not be affected by that redirection).

You may need to ensure both http and https document roots match.
If not, then they would not return the same content…
Or one may fail altogether for lack of, or mismatched DirectoryIndex type statements.
[nginx uses “index”]


#4

Apologies for the delay in replying, I went back and started again and found I had indeed made a mistake when setting up the server blocks. Thanks for your help.


#5

Better late than never.
Better HTTPS then HTTP :slight_smile: