Deploy the repository and open the live website
The next commands clone the public starter repository onto EC2 and copy only the website files into Nginx's public directory.
Step 7 — Clone and deploy website files
Inside your active SSH terminal on EC2, download the starter website repository branch:
• cd ~: Navigates to your remote user's home directory (/home/ec2-user).
• git clone --branch gh-pages --single-branch: Downloads only the starter template branch rather than the entire commit history.
• ls -la ~/my-first-website: Inspects the downloaded files. Confirm that index.html, style.css, script.js, logo.png, and background.jpg exist before copying.
Copy Only Public Website Files
The Nginx document root for this workshop is /usr/share/nginx/html/. Copy the HTML, CSS, JavaScript, and referenced image assets into that directory:
• sudo cp ... /usr/share/nginx/html/: Copies the five designated public assets into Nginx's default web directory.
• sudo nginx -t: Verifies Nginx configuration syntax for any syntax or permissions errors.
• sudo systemctl reload nginx: Gracefully reloads the web server to immediately serve the new files.
Never place .env files, passwords, AWS access keys, private SSH keys, API tokens, or other secrets in /usr/share/nginx/html/.
This directory is for website assets that visitors may freely download over the public internet. Anything served publicly should be treated as information accessible to everyone. Keep private configuration and credentials outside the web root.
Step 8 — Open the live website
Open a new browser tab on your computer and paste your instance's public IPv4 address with the http:// prefix:
• Replace YOUR_PUBLIC_IP with the actual public IPv4 address copied from the EC2 Console.
• HTTP vs HTTPS: This starter exercise uses plain HTTP on port 80. HTTPS requires a custom domain, DNS validation, and a TLS certificate, which are covered in subsequent advanced workshops.
• IP Persistence: A standard public IPv4 address will change if the EC2 instance is stopped and restarted. If your URL stops responding after a restart, check the updated public address in the EC2 Console.
Screenshot Targets for the Live Workshop
Students completing this workshop for credit or certification must capture the five required operational milestones:
Capture your browser address bar showing the active public IPv4 address alongside the deployed website rendering correctly. This represents primary tangible proof that your public web server is working.
http://YOUR_PUBLIC_IP).Your Website Is Live
Congratulations! You have taken a static website from a GitHub repository, prepared an EC2 virtual machine, configured firewall network rules, installed Nginx on Amazon Linux 2023, published the files, and verified the live result through a public browser URL.
If your website does not look correct or the public URL does not respond, use the systematic troubleshooting checklist in the next chapter to diagnose the problem.
