Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.98 minutes in June 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Unresponsive Website on EC2 – How to verify and resolve?

by | Jul 18, 2021

Stuck with an Unresponsive Website on EC2? We can help you.

At times, we may fail to connect to the public website on the Amazon EC2 instance.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how we can resolve this issue.

 

Unresponsive Website on EC2

Websites can become unreachable for multiple reasons. To make sure the configuration settings are correct, our Support Techs recommend the following:

 

  • Verify the instance runs and passes both status checks.

First and foremost, we need to ensure the instance is listed as running in the Amazon EC2 console.

We can view the status check metrics to determine if the instance fails the system status check or the instance status check.

If it fails, it might be due to operating system-level issues.

 

  • Verify that the instance boots correctly.

To find boot errors, we can check the instance’s system logs.

Most often it will be kernel panic errors or other operating system errors.

 

  • Verify the instance’s security group and network ACL configuration.

The instance’s associated security group and network ACL should allow traffic on ports 80 and 443.

In addition, the route table in the instance’s subnet should have a default route to an internet gateway.

 

  • Verify that the instance has the correct DNS configuration.

Suppose the website uses Route 53 DNS service. In that case, we verify the configuration of the DNS records.

The instance must have an Elastic IP address assigned to it.

We have to map the public IP address or Elastic IP address to an A-record.

 

  • Verify that the webserver runs and there are no OS-level firewalls.

Various services send requests to the network ports.

Generally, the webservers listen on port 80 for HTTP traffic and use port 443 for traffic encrypted with TLS/SSL.

If it isn’t running, or firewalls block these ports, then we can’t connect to the website.

1. To resolve this, we remotely connect to the instance via SSH.

2. Then to verify the web server’s status, we run:

$ sudo systemctl status httpd
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)

Here, we can see the command returns an inactive status.

3. To restart the webserver, we run:

$ sudo systemctl restart httpd

4. Then we run the following command to verify that the webserver runs now:

$ sudo systemctl status httpd
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-11-19 14:40:15 UTC; 42s ago

In case we have an older Linux system running SystemV, we use:

$ sudo service httpd status
httpd is stopped

Eventually, to restart a stopped web server on SystemV, we run:

$ sudo service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]

5. To confirm that the web server listens on port 80 or 443, we run:

$ sudo netstat -tulpn | grep httpd
tcp 0 0 :::80 :::* LISTEN 2961/httpd

6. We then verify the status of OS-level firewalls.

In case of an active firewall, we make sure it allows requests on ports 80 and 443:

 

Amazon Linux, CentOS, and RHEL:

1. Initially, we verify the iptables rules block incoming requests on ports 80 and 443:

$ sudo iptables -nvL

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

2. Then to allow port 80 to accept incoming HTTP connection requests, we run:

$ sudo iptables -A INPUT -p tcp --dport 80 --syn -m conntrack --ctstate NEW -j ACCEPT

3. Similarly, to allow port 443 to accept incoming HTTPS connection requests, we run:

$ sudo iptables -A INPUT -p tcp --dport 443 --syn -m conntrack --ctstate NEW -j ACCEPT

 

Amazon Linux 2 and RHEL 7 and above:

1. Firstly, we verify that firewalld is running:

$ sudo firewall-cmd --state
running

2. Then to configure it to allow connections on ports 80 and 443, we run

$ sudo firewall-cmd --add-service=http --permanent
success
$ sudo firewall-cmd --add-service=https --permanent
success
$ sudo firewall-cmd --reload
success

 

Debian and Ubuntu servers:

1. We use the following command to check for a UFW firewall:

$ sudo ufw status verbose
Status: active

2. If it runs, to allow incoming connection requests on ports 80 and port 443, we use:

$ sudo ufw allow in 80/tcp
Rule added
Rule added (v6)
$ sudo ufw allow 443/tcp
Rule added
Rule added (v6)

We can also check the webserver access error logs for issues. Generally, we can find them at /var/log.

The default web server log locations are:

Amazon Linux and RHEL: /var/log/httpd
Debian and Ubuntu: /var/log/apache2

[Need help with the resolution? We’d be happy to assist]

 

Conclusion

In short, we saw how our Support Techs go about an Unresponsive Website on EC2.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

AWS Support

Use your time to build great apps. Leave your servers to us.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.
AWS Support

Use your time to build great apps. Leave your servers to us.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.

Categories:

Tags:

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF