Cannot access my website anymore

Keywords: WordPress - AWS - Technical issue - Domain Name (DNS)
bnsupport ID: a0ecf000-29f6-0f69-69b3-6465f854dc64
Description:
Hi,

I hadn’t logged into my website for some time and after some months I checked it out and I can no longer access the site via the domain name or the AWS EC2 public IP (3.9.63.175).

I can access the server via SSH, but no idea what’s happened to the public HTTP access.

The HTTP port is configured in AWS to allow public access.

Can anyone help me troubleshoot, please?

Thanks in advance!

Hi @robdcal,

Thanks for running the bnsupport bundle. According to it, your server is running out of free memory. There are also permissions issues with the WordPress files. Can you check the links below to fix them?

✓ Database: No issues found
✓ Apache: No issues found
? WordPress: Found possible issues
? Resources: Found possible issues
  1. Some files don’t have the expected permissions Please check the following guide:

https://docs.bitnami.com/general/apps/wordpress/administration/understand-file-permissions/

  1. The WordPress domain does not seem to be configured. Please check the following guide:

https://docs.bitnami.com/general/apps/wordpress/administration/configure-domain/

  1. Your instance has little available RAM memory.
              total        used        free      shared  buff/cache   available
Mem:            990         681          68          36         240          92
Swap:           634          24         610

You could try to upgrade your instance. Please check your cloud provider’s documentation for more information.

Apart from that, it looks like your DNS domain is not pointing to any valid IP address. You can check it on the next website

https://www.whatsmydns.net

It also seems your AWS server is using a different IP address now. It usually happens when you are using a dynamic IP address and your server is restarted.

Thanks for the response @gongomgra

I’ve taken care of each of those points. New IP is 18.135.18.57

I’m still not seeing anything when visiting the IP or the domain. Any ideas?

New bnsupport ID is a5ae2166-f75d-bd1e-1672-ea7469306a15

Thanks

Hi @robdcal,

I checked the bnsupport bundle and I think I found the issue. You are redirecting IP_address to www.IP_address, which is not valid. If you want to redirect the IP address to your domain, you will need to replace the next snippet in /opt/bitnami/apache2/conf/bitnami/bitnami.conf

  # BEGIN: Enable HTTP to HTTPS redirection
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !^localhost
  RewriteCond %{HTTP_HOST} !^127.0.0.1
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
  # END: Enable HTTP to HTTPS redirection
  # BEGIN: Enable non-www to www redirection
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^localhost
  RewriteCond %{HTTP_HOST} !^127.0.0.1
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection

with the one below. Replace YOUR_DOMAIN placeholder

RewriteEngine On
RewriteCond %{HTTP_HOST} !^YOUR_DOMAIN$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteCond %{REQUEST_URI} !^/\.well-known
RewriteRule ^(.*)$ https://YOUR_DOMAIN$1 [R=permanent,L]

After that, restart Apache

sudo /opt/bitnami/ctlscript.sh restart apache

Hi @gongomgra

Thanks again for your assistance.

I’ve done what you suggested but all that happens is it redirects my IP address to my domain, which still doesn’t work…

For clarity, the reason I am sharing the IP address is because I didn’t want to share the domain publicly. Will your recommendation have changed the way people visiting my domain is now handled (i.e. http to https and non-www to www)?

Going back to my issue, it still does not seem to be working…

Hi @robdcal,

Can you provide us with more information about the issue you are facing? If you want to redirect non-www to www, then please update the configuration I shared with the one below

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.YOUR_DOMAIN$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteCond %{REQUEST_URI} !^/\.well-known
RewriteRule ^(.*)$ https://www.YOUR_DOMAIN$1 [R=permanent,L]

Hi @gongomgra, if you visit the IP, what do you see?

I see an error when I visit the IP or the domain (it doesn’t matter which). The problem looks to be with the server config or something.

Hi @robdcal,

I think I know what is the error here. It looks like you are configuring your website to be server with www but the www domain is not pointing to your server IP address.

$ curl -kLI "http://18.135.18.57"
HTTP/1.1 301 Moved Permanently
Date: Mon, 05 Apr 2021 08:53:19 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Location: https://robcallaghan.co.uk/
Content-Type: text/html; charset=iso-8859-1

HTTP/1.1 301 Moved Permanently
Date: Mon, 05 Apr 2021 08:53:19 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Location: https://www.robcallaghan.co.uk/
Content-Type: text/html; charset=iso-8859-1

curl: (6) Could not resolve host: www.robcallaghan.co.uk

If you want to access your server using it, you would need to update your DNS registries (usually with a CNAME from www.yourdomain.com to yourdomain.com).

You’re likely to experience this problem when you use a dynamic IP address and the server is restarted.

Thanks @gongomgra - the www CNAME record was pointing to the IP, not the root domain. That fixed it!

Hi @robdcal,

Thanks for the info. I’m glad you fixed your issue! We will close this thread as solved. Please do not hesitate to open a new one with any other questions you may have.