Fixing ERR_CONNECTION_REFUSED errors attempting to connect to my site after changes

After upgrading(?) my Mac to MacOS Mojave, I found the hard disk access speed intolerable. Boot ups would take several minutes, and everything took far too long. I finally switched my Mac to boot up off of an external USB Solid State Drive (SSD). After cloning my hard drive to the SSD and switching it to be the default boot drive, the old(ish) Mac is once again pleasantly fast and usable.

However, after this change, I found that, whenever I attempted to connect to my site, any browser I tried to connect to it through would give a message about being unable to connect to the server. One specific message shown in Google Chrome was

ERR_CONNECTION_REFUSED

The first part of the solution came from a Stack Overflow answer by adang. In a terminal, I ran

sudo vi /etc/apache2/httpd.conf

I then uncommented the following lines by removing the pound ("#") at the start of the line containing them:

LoadModule authz_core_module libexec/apache2/mod_authz_core.so

LoadModule authz_host_module libexec/apache2/mod_authz_host.so

LoadModule userdir_module libexec/apache2/mod_userdir.so

LoadModule include_module libexec/apache2/mod_include.so

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

LoadModule php7_module libexec/apache2/libphp7.so

Continuing with the instructions in the solution, I ran the following two commands:

sudo apachectl restart

apachectl configtest

The configtest revealed that apache was unable to find the specified SSL certificate file. As I compared the finder contents for the new SSD and the original hard drive, at first I thought that the certificate file had not copied over. So, I attempted to copy it from the hard drive to the SSD. However, as I tried to navigate through the folders on both drives, I found that the problem wasn't that the file had not been copied during the cloning process, it was that I was unable to even see the contents of the folder containing the certificate files due to permissions. I needed to add read and execute rights to the folder as follows:

sudo chmod 755 /etc/letsencrypt/archive/

Once I did this, I was able to

sudo ls /etc/letsencrypt/archive/[domain-name]

and confirm that all files required were, in fact, there. Repeating the two apachectl commands this time resulted in the results being OK.

After doing this, I found that I needed to renew my letsencrypt SSL certificate.

certbot --version

showed that I was running an outdated version of certbot. I ran the following commands to update certbot, renew the certificate, and confirm that it had been updated.

brew update

brew upgrade certbot

sudo certbot certonly -w /path/to/website/ -d [domain-name] --preferred-challenges http

(I chose option 1, apache plug-in, when asked.)

sudo certbot renew --dry-run

After all this, the site is as good as new. I hope my directing people to the original solution for the main problem, and my steps for updating the SSL certificate, may be helpful to others.

Comments

Popular posts from this blog

Using KeePass with Dropbox for Cross-Platform Password Management

Visiting CareLink Site on OS X Mavericks

Website FINALLY Adapted to Apple Silicon