How to Host a Website on AWS EC2 Using a Free CSS Template: Complete Guide
By Braincuber Team
Published on March 13, 2026
You do not need to be a full-stack developer to launch a beautiful website. Many founders spend weeks fighting with complex frontend frameworks just to launch a simple landing page. If you just need a professional, fast, and secure webpage online tomorrow, nothing beats the simplicity of a raw HTML/CSS template hosted on a raw AWS EC2 server. In this complete tutorial, we will bypass the heavy frameworks entirely. We will SSH into a blank Linux machine, install an Apache web server, fetch a premium-looking CSS template directly from the source, and make it publicly available to the world — step by step.
What You'll Learn:
- How to install the Apache HTTPD web server on Amazon Linux 2
- How to fetch files directly to your EC2 instance using
wget - Extracting and managing ZIP archives via the Linux command line
- Configuring file directories so Apache serves your template correctly
- Accessing and verifying your live website via its Public IP
Why Use a Bare Metal EC2 Instance?
You could use a managed service like AWS Amplify to host a static site. So why do we recommend learning to do it manually on an EC2 instance? Because relying exclusively on managed services creates infrastructure blind spots.
Absolute Control
When you host directly on an operating system, you control the routing, the HTTP headers, the caching logic, and the security modules. There is no abstraction layer blocking you from adding exactly what you need.
Fundamental Skill Building
Understanding how Apache serves files from /var/www/html is a foundational DevOps skill. If you don't understand how a basic web server works, you will struggle to debug complex containerized applications later.
The Step-by-Step Deployment Plan
For this tutorial, we assume you have already launched an Amazon Linux 2 EC2 instance and have successfully connected to it via SSH or MobaXterm. If your instance is not running yet, you must launch one and ensure its Security Group allows inbound traffic on Port 80 (HTTP).
Install and Start the Apache Web Server
First, we need the software that actually serves your web pages to visitors. In your SSH terminal, install HTTPD by running sudo yum install httpd -y. Next, start the service with sudo systemctl start httpd. Finally, ensure it automatically restarts if the server reboots by running sudo systemctl enable httpd.
Navigate to the Public HTML Directory
Apache serves files from a very specific folder on your hard drive. Type cd /var/www/html to move into this directory. Any file placed inside this directory will be publicly accessible on the internet via your server's IP address. Be careful what you put here.
Fetch the CSS Template via Wget
Instead of downloading the template to your laptop and transferring it over FTP, you can tell your EC2 instance to download it directly. Run sudo wget https://www.free-css.com/assets/files/free-css-templates/download/page284/built-better.zip. This pulls the "Built Better" template archive straight into your web folder.
Extract the Archive and Clean the Directory
First, install the unzip tool: sudo dnf install unzip -y. Next, extract the template: sudo unzip built-better.zip -d /var/www/html/. The template likely creates a subfolder (like html) containing the actual index file. You must move those files up to the root folder so Apache finds them immediately. Run sudo mv /var/www/html/html/* /var/www/html/. Then, clean up the junk: sudo rm -r /var/www/html/html and sudo rm built-better.zip.
Test Your Live Webpage
Go back to your AWS Management Console. Open the EC2 Dashboard, select your instance, and copy the Public IPv4 address shown in the details panel. Open a new tab in your web browser and paste that IP. You should immediately see the fully styled "Built Better" template loaded on your screen.
The Complete Script Reference
If you ever want to automate this process in the future using EC2 User Data, here is the full sequence of commands grouped together.
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
cd /var/www/html
sudo wget https://www.free-css.com/assets/files/free-css-templates/download/page284/built-better.zip
sudo dnf install unzip -y
sudo unzip built-better.zip -d /var/www/html/
sudo mv /var/www/html/html/* /var/www/html/
sudo rm -r /var/www/html/html
sudo rm built-better.zip
Missing the Root Directory
The most common mistake beginners make is failing to move the unzipped files out of their parent folder. If you unzip a template and it creates a folder called my_site_v2, Apache will not read it automatically. Apache looks exclusively for an index.html file located directly inside /var/www/html/. If your site displays a generic "Apache Test Page," your files are in the wrong directory.
Frequently Asked Questions
Why isn't my EC2 IP address loading in the browser?
Ensure your Security Group has an inbound rule allowing HTTP traffic on Port 80 from anywhere (0.0.0.0/0). If this is missing, the AWS firewall blocks all web requests before they even reach Apache.
Will the public IP address of my EC2 instance change?
Yes, if you stop and restart the instance, AWS assigns a new public IP. If you want a permanent IP address that survives reboots, you must allocate an Elastic IP from the AWS console and associate it with the instance.
Can I host multiple sites on the same EC2 instance?
Yes, Apache supports Virtual Hosts. This allows you to serve entirely different websites depending on which domain name the user requested, routing them to different folders inside /var/www/.
What does the 'chmod' command do if I need it?
If Apache returns a "403 Forbidden" error, it means the server doesn't have operating system permission to read the files. You may need to use chmod to adjust the file permissions so the Apache user can access them.
Can I edit my HTML files directly on the EC2 server?
Yes. You can use command-line text editors like 'nano' or 'vim' to edit files directly via SSH. For example, running 'sudo nano /var/www/html/index.html' lets you change the website text instantly.
Is Your AWS Architecture Slowing You Down?
Running simple EC2 instances manually is great for learning, but terrible for scaling a D2C brand. If your traffic spikes, a single server will crash, taking your sales with it. Our engineers deploy auto-scaling, load-balanced infrastructure that handles extreme traffic surges gracefully — without you having to touch a terminal.
