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.
YOUR_PUBLIC_IP with the actual public IPv4 address of your instance.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 -tbefore 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.
Two-Branch Diagnostic Flowchart
Browser shows connection timeout, connection refused, or infinite loading.
Nginx is running and serving files internally.
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.
Nginx is stopped, crashing, or misconfigured.
Check systemctl status nginx, examine error logs with sudo journalctl -u nginx, and verify web root directory permissions.
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.
Ask the student to reproduce or describe the symptom accurately (e.g. browser timeout vs HTTP 403 Forbidden vs Nginx welcome page).
Ask which command or browser Developer Tools observation narrows down the root cause before touching any settings.
Determine whether the failure is in the Nginx service daemon, web root file permissions, or AWS VPC public network ingress.
Change only the single setting or file supported by diagnostic evidence. Never change multiple variables simultaneously.
Repeat the relevant diagnostic command, confirm HTTP 200, and verify the website renders cleanly in the browser.
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
"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."
Before declaring the issue fixed
Verify all criteria before concluding your debugging session.
