Pointing A Subdomain From Route53 To CENTOS Droplet Displaying Error : This site can’t be reached The connection was reset

September 28, 2018 691 views
DNS Networking Apache Firewall CentOS

Am trying to point a subdomain from Route53 to a Droplet I created. I keep getting, The Site Cannot be reached the connection was reset error.

Below is my setup

I have a virtual host setup on my centOS droplet like this:

<VirtualHost *:80>
ServerName savings.corpreneur.com.ng

DocumentRoot /var/www/html/platform/public

<Directory /var/www/html/platform/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
DirectoryIndex index.php
</Directory>

#ErrorLog /var/www/html/platform/error.log
LogLevel warn
#CustomLog /var/www/html/platform/access.log combined
RewriteEngine on
RewriteCond %{SERVERNAME} =savings.corpreneur.com.ng
RewriteRule ^ https://%{SERVER
NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

As for my /etc/hosts file, I have the following content:

127.0.0.1 corpreneur corpreneur
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4
139.59.150.44 savings.corpreneur.com.ng

On AWS Route53 I created A Record with the below Detail

Name: savings .corpreneur.com.ng
Value: 139.59.150.44

And On My Droplet I have below

Record Hostname Value
A savings.corpreneur.com.ng 139.59.150.44
NS savings.corpreneur.com.ng ns1.digitalocean.com
NS savings.corpreneur.com.ng ns2.digitalocean.com
NS savings.corpreneur.com.ng ns3.digitalocean.com

When I check the NS record, it shows DigitalOcean NS record https://dnschecker.org/#NS/savings.corpreneur.com.ng

When I Also Check the A record https://dnschecker.org/#A/savings.corpreneur.com.ng
It shows the IP of the droplet

So could it be an issue with SELinux and not my setup?

I expect this to work but it doesn’t, am confused about this, what am I doing wrong. I need help on this. Thanks!

2 Answers
unixynet September 28, 2018
Accepted Answer

Hi,

You have a redirect to HTTPS in your port 80 vhost. But you’re missing the SSL vhost (for port 443). So Apache isn’t listening on that port at all. Hence the connection reset error:

$ curl -I http://savings.corpreneur.com.ng/
HTTP/1.1 301 Moved Permanently
Date: Fri, 28 Sep 2018 19:15:13 GMT
Server: Apache/2.4.6 (CentOS)
Location: https://savings.corpreneur.com.ng/
Content-Type: text/html; charset=iso-8859-1

$ curl -vvv https://savings.corpreneur.com.ng/

  • Trying 139.59.150.44…
  • connect to 139.59.150.44 port 443 failed: Connection refused
  • Failed to connect to savings.corpreneur.com.ng port 443: Connection refused
  • Closing connection 0
  • But then a new problem arises, the PHP is just echoed and not executed. Any ideas why?

    • That’s a different issue. You’ll need this so someone can help:

      1. New question here on DO

      2. Post your PHP related directives from the Apache configs if any

      3. I’m sure someone will help

      Cheers

Thanks very much, I just needed to install cert-bot. Everything was taken care of with cert-bot auto.

Am grateful

Have another answer? Share your knowledge.