Installing and upgrading help

Let's encrypt and https

 
Picture of Javier Tejera
Let's encrypt and https
 
I have succesfully installed https in two Moodle sites hosted in Siteground. I did as follows:

  • Install Let's Encrypt certificate 
  • Change "http" to "https" in $CFG->wwwroot (config.php)

What is weird is I am trying to do the same process in another Moodle site hosted also in Siteground, but I am having an ERR_TOO_MANY_REDIRECTS

Any idea what could be the problem?

Thanks in advance

 
Average of ratings: -
Picture of Ken Task
Re: Let's encrypt and https
Particularly helpful Moodlers

Moodle records internal links to the DB ... when you move from http to https one has to use the search and replace tool to search for http://site/ and replace with https://site/

In Moodle 3.4 there is a special tool to do that .... https://site/admin/tool/httpsreplace/

If version is less than 3.4, then https://site/admin/tool/replace/

Might need to purge caches as well.

'spirit of sharing', Ken


 
Average of ratings: -
Picture of Javier Tejera
Re: Let's encrypt and https
 

Ken, thanks.

I thought I had to run that special tool after install the Let's Encrypt certificate. I guess I have to do it before. I am afraid that something can break down - or is it just quite straightforward?

 
Average of ratings: -
Picture of Emma Richardson
Re: Let's encrypt and https
Documentation writersParticularly helpful MoodlersPlugin developers

It is very simple to run - but can you not get to the site at all?  Are you running this through a proxy by chance?

 
Average of ratings: -
Picture of Javier Tejera
Re: Let's encrypt and https
 
I am not a developer, so don't really know if it's a proxy. I do this process through cPanel of a Sitegroung hosting account.

What would you suggest? Shall I:

  1. Run httpsreplace tool
  2. Install Let's Encrypt
  3. Change config.php

I am afraid if I do (1) and it doesn't work if I will be have http again.

 
Average of ratings: -
Picture of Ken Task
Re: Let's encrypt and https
Particularly helpful Moodlers

1. do site backup consisting of code directory and a DB dump

2. check that your server will respond to port 443 ... in a browser, https://yoursite:443

Yes, that will  error but as long as web service is talking 443 then next step

3. install Let's Encript ... more than likely you'll have to restart web services ... after that do the same check above.

Look at the secure Icon to check the cert.

4. change the config.php file

5. access the site via https:// it will look messed up .... theme won't look normal.   login.  Navigate to the replace tool you need and run the replace ...

6. purge cache.

7. Logout

8. clear browser of cookies and cache to your site

9. Access site again using https ... and as a test access with http to see how Moodle re-acts.

'spirit of sharing', Ken


 
Average of ratings: -
Picture of Javier Tejera
Re: Let's encrypt and https
 

Hi Ken, I really appreciate your help.

I am already stuck in (2):

ERR_CONNECTION_TIMED_OUT


 
Average of ratings: -
Picture of Emma Richardson
Re: Let's encrypt and https
Documentation writersParticularly helpful MoodlersPlugin developers

You might check that you don't have an https option in siteground that needs turned on too - I would talk to their tech support as a timeout sounds like more of a server issue than a moodle issue.

 
Average of ratings: -
Picture of Javier Tejera
Re: Let's encrypt and https
 
I've contacted then and their response is that somewhere in my files I have a HTTP. Really weird, not working anything at all.

Not sure if this is important, but this Moodle site is a subdomain of my "main website", but this subdomain has his own hosting plan totally independent from the main one. Has this subdomain something to do with it?


 
Average of ratings: -
Picture of Ken Task
Re: Let's encrypt and https
Particularly helpful Moodlers

You might review documentation for LetsEncrypt.

https://letsencrypt.org/getting-started/

They have this:

https://certbot.eff.org/

a little tool for getting directions specific to how you are running your server.  Link above has this atop the page:

"Trying to get a wildcard certificate? Please use the dropdown menus below to get instructions specific to your system, and read those instructions carefully."

When you say 'subdomain' ... you have a web site @ www.yourdomain.tld and the moodle is something like moodle.yourdomain.tld ... is that correct?

I would think, you would want a 'wildcard' cert that would cover/be good for www. site as well as moodle. site.

Don't use LetsEncrypt so the above is really some 'leg work' for ya ... I hope!

'spirit of sharing', Ken


 
Average of ratings: -
Picture of Javier Tejera
Re: Let's encrypt and https
 

PROBLEM SOLVED:

The root directory contained an ‘.htaccess’ file with the following lines:

RewriteEngine On

RewriteCond %{SERVER_PORT} 443

RewriteRule ^(.*)$ http://academy.volunteeredinburgh.org.uk/$1 [R=301,L]

This was causing a redirect loop when attempting access via https instead of http. Solution was to delete this file.

Thanks all for the support.


 
Average of ratings: -