1. Check the Public IP Address
When you restart an EC2 instance, the public IP address might change if you are not using an Elastic IP. Check the new public IP address assigned to your instance:
Go to the AWS Management Console.
Navigate to EC2 > Instances.
Select your instance and check the "Public IPv4 address" field.
If the IP address has changed, update your DNS records to point to the new IP address.
2. Check Security Groups
Ensure that the security group attached to your instance allows inbound traffic on the necessary ports (usually port 80 for HTTP and port 443 for HTTPS):
Go to the AWS Management Console.
Navigate to EC2 > Instances.
Select your instance and click on the "Security" tab.
Click on the security group and check the inbound rules. Ensure that rules for ports 80 and 443 are present and allow traffic from all sources (0.0.0.0/0).
3. Check Network ACLs
Ensure that Network ACLs allow inbound and outbound traffic on the necessary ports.
Go to the AWS Management Console.
Navigate to VPC > Network ACLs.
Select the ACL associated with your instance’s subnet and ensure that it allows traffic on ports 80 and 443.
4. Check Apache/Nginx Service Status
Ensure that your web server (Apache or Nginx) is running:
sudo systemctl status apache2 # For Apache
# or
sudo systemctl status nginx # For Nginx
If the service is not running, start it:
sudo systemctl start apache2 # For Apache
# or
sudo systemctl start nginx # For Nginx
5. Check Web Server Configuration
Verify that your web server is correctly configured to serve your website.
For Apache:
Check Virtual Host Configuration:
sudo nano /etc/apache2/sites-available/000-default.conf
Ensure DocumentRoot and Directory Permissions:
Ensure that the DocumentRoot is pointing to the correct directory and the <Directory> block has the correct permissions.
Restart Apache:
sudo systemctl restart apache2
For Nginx:
Check Server Block Configuration:
sudo nano /etc/nginx/sites-available/default
Ensure Root Directive:
Ensure that the root directive is pointing to the correct directory.
Restart Nginx:
sudo systemctl restart nginx
6. Check File and Directory Permissions
Ensure that the web server user (usually www-data for Apache/Nginx) has the necessary permissions to read the files and directories of your web application.
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
7. Check Application Logs
Check the logs for any errors:
For Apache:
sudo tail -f /var/log/apache2/error.log
For Nginx:
sudo tail -f /var/log/nginx/error.log
For Laravel (if applicable):
sudo tail -f /var/www/html/storage/logs/laravel.log
8. Check Firewall Rules
Ensure that the firewall on your instance (if any, such as ufw on Ubuntu) is not blocking traffic:
sudo ufw status
Allow necessary ports if needed:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
0 More Answers