Ravindra BagaleCourses & study guides

Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)

7.1 Why and what

Mitranno, this is the chapter where you will see your own web page live on the internet for the first time — that moment is always special in my sessions. Let's first understand what a static website is. A static website is made only of files — HTML, CSS, JavaScript, images, fonts — that are sent to the browser exactly as stored on disk. There is no server-side code and no database. Examples: portfolio/resume sites, college fest pages, documentation, landing pages and the built output of React/Angular/Vue apps.

Why host it on EC2? It is the best way to learn web-server configuration, permissions and troubleshooting. (In production, very simple static sites are often hosted on Amazon S3 + CloudFront, but the EC2 skills here apply to every dynamic app you will host later.)

How it works: Browser → port 80 on the EC2 public IP → security group allows it → Nginx/Apache maps the URL path to a file under the document root → returns the file.

 URL:   http://13.233.10.25/css/style.css
 root:  /var/www/mysite
 file:  /var/www/mysite/css/style.css     (root + URL path)