04 / TROUBLESHOOTING GUIDEPAGE 2 OF 2

Your first debugging toolkit

Use these commands as evidence. A command output tells you something specific; it does not prove every other layer is correct.

Diagnostic Commands

Terminal inspection commands isolate each layer of your infrastructure. Run them systematically to gather proof of where a breakdown occurs.

DIAGNOSTIC COMMANDS — RUN IN THE CONTEXT SHOWN
# 1. Check the web server
sudo systemctl status nginx --no-pager

# 2. Start it if the service is stopped
sudo systemctl start nginx

# 3. Test HTTP locally
curl -I http://localhost

# 4. Check the deployed files
ls -la /usr/share/nginx/html

# 5. Validate Nginx configuration syntax
sudo nginx -t

# 6. Read recent error logs
sudo tail -n 50 /var/log/nginx/error.log

# 7. Read recent access logs
sudo tail -n 50 /var/log/nginx/access.log

# 8. Test the public endpoint from your laptop
curl -I http://YOUR_PUBLIC_IP
Run commands 1–7 on EC2. Run command 8 on your laptop. Replace YOUR_PUBLIC_IP with the actual public IPv4 address of your instance.
Important: State-Changing vs Diagnostic Commands

sudo systemctl start nginx should only be run if the service is stopped or inactive and the available diagnostic evidence indicates that starting it is appropriate.

Starting a service is an action that changes system state; it is not merely an inspection command. For an inexperienced student:

  • Inspect the service status first with sudo systemctl status nginx.
  • Review error logs if it failed (sudo tail -n 50 /var/log/nginx/error.log).
  • Check the Nginx configuration syntax using sudo nginx -t before starting or reloading.
  • Start the service only when appropriate, then immediately re-test locally with curl -I http://localhost.

Debug in layers — change one thing at a time

Use the diagnostic flowchart below to determine whether your deployment issue is located inside the operating system or out on the AWS VPC network perimeter.

DIAGNOSTIC WORKFLOW

Two-Branch Diagnostic Flowchart

SYSTEMATIC ISOLATION
OBSERVED SYMPTOM
Website does not load

Browser shows connection timeout, connection refused, or infinite loading.

ISOLATION CHECK (RUN ON EC2)
curl -I http://localhost
"Does the server answer locally?"
YES — LOCAL REQUEST WORKS

Nginx is running and serving files internally.

Next Diagnostic Focus: Public Network

Check the Public IPv4 address, verify Inbound Security Group port 80 allows traffic from 0.0.0.0/0, and confirm subnet Route Table routes to an Internet Gateway.

Note: Do not modify website HTML; the server already serves it locally.
NO — LOCAL REQUEST FAILS

Nginx is stopped, crashing, or misconfigured.

Next Diagnostic Focus: Internal Web Server

Check systemctl status nginx, examine error logs with sudo journalctl -u nginx, and verify web root directory permissions.

Rule: If curl fails locally, fixing Security Groups will NOT resolve it.
IF THE LOCAL SERVER RESPONDS BUT THE PUBLIC URL DOES NOT, START WITH NETWORKING — NOT THE HTML.

Instructor mini-activity: find the fault

Choose one controlled fault: stop Nginx, temporarily remove the HTTP inbound rule, or move index.html out of the document root. Do not tell students which one you changed. Ask them to describe the symptom, collect evidence, identify the layer, and fix the cause.

01
Observe

Ask the student to reproduce or describe the symptom accurately (e.g. browser timeout vs HTTP 403 Forbidden vs Nginx welcome page).

02
Collect evidence

Ask which command or browser Developer Tools observation narrows down the root cause before touching any settings.

03
Identify the layer

Determine whether the failure is in the Nginx service daemon, web root file permissions, or AWS VPC public network ingress.

04
Make one controlled fix

Change only the single setting or file supported by diagnostic evidence. Never change multiple variables simultaneously.

05
Verify again

Repeat the relevant diagnostic command, confirm HTTP 200, and verify the website renders cleanly in the browser.

Instructor Safety Requirements

This activity is performed only in a controlled workshop instance with instructor approval. Do not make changes to shared production resources. Avoid exposing SSH to the internet. If the security group is changed, do not remove essential administrative access. Restore the original intended configuration before the activity ends. Confirm that the website works after the fault is corrected. Do not hide changes from participants in a way that risks affecting their real AWS resources. The purpose is a safe, reversible learning exercise.

Debugging Rule

DEBUGGING RULE

"If curl to localhost works but the public URL fails, focus on networking: the public address, route, security group, and public connectivity. If localhost fails too, focus on Nginx, configuration, service logs, and deployed files."

Key Takeaway: Use the results of one check to decide the next check. Do not change several settings at once, because you may hide the original cause.

Before declaring the issue fixed

Verify all criteria before concluding your debugging session.

Full-Scale AWS Deployment BlueprintArchitecture Map

Interactive end-to-end cloud pipeline: from Git starter repository to live Nginx server.

AWS Cloud Launchpad Architecture and Deployment Blueprint
EC2 • VPC • NGINX • GIT • SECURITY GROUPS
Source: src/public/assets/image.png
AWS LAUNCHPAD 2026•Hosted by AWS SBG PSIT