Redirect www to non-www in EC2-powered Ghost

Description

I’m running Ghost on an EC2 instance and I opted for enabling a LetsEncript certificate when going through the initial setup.

The non-www version works well, but I’d like to redirect the www version to non-www. I’m getting this error when trying to access www.paulrberg.com:

Your connection isn’t private

NET::ERR_CERT_COMMON_NAME_INVALID

I suppose that the issue is that LetsEncrypt didn’t include the www subdomain in its certificate.

How could I solve this?

Environment

  • ubuntu@18.04
  • node@12.18.3
  • mysql@5.7
  • ghost@1.14.1

This has been answered on the forum many many times, most notably with extra information here:

Thanks @Hannah and apologies, I missed that.