Introduction
Building a web server from scratch is an essential skill for any cloud or DevOps engineer. This project walks you through provisioning a Linux server, installing Apache, deploying a custom HTML landing page, and securing the server with SSL encryption. Whether you're a beginner or looking to solidify your skills, this guide provides practical steps to help you deploy a scalable and secure web server.
Objective
The main goals of this project are:
- Provision a Linux server on AWS.
- Install and configure Apache as a web server.
- Create and deploy a custom HTML landing page.
- Configure networking to allow HTTP (port 80) and optionally HTTPS (port 443) traffic.
- Secure the server with SSL encryption using Certbot.
Tools and Technologies Used
- Cloud Platform: AWS (Amazon Web Services)
- Linux Distribution: Ubuntu
- Web Server: Apache
- SSH: For server connection and management
- HTML: To design the landing page
- Certbot: To manage SSL certificates for HTTPS
Steps to Build the Project
1. Provisioning the Server on AWS
Step 1: Sign In to AWS
- Go to the AWS Management Console.
Step 2: Launch a New Instance
- Navigate to EC2 and click "Launch Instance."
- Choose an Ubuntu Linux AMI (e.g., Ubuntu 22.04 LTS).
- Configure instance settings:
- Assign a public IP for accessibility.
- Choose an instance type (e.g., t2.micro for free tier users).
Step 3: Configure Key Pair
- Create a new key pair and download the private key file (.pem).
Step 4: Configure Security Group
- Allow the following inbound rules:
- HTTP (port 80)
- HTTPS (port 443)
- SSH (port 22)
Step 5: Launch the Instance
- Click "Launch Instance" and wait for it to start running.
2. Connecting to the Server
- Open a terminal or Git Bash.
- Use the private key to SSH into the server:
ssh -i path_to_private_key.pem ubuntu@public_ip_address
3. Setting Up the Web Server
-Switch to root user sudo -i
Step 1: Update the System
sudo apt update && sudo apt upgrade -y
Step 2: Install Apache
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2
Step 3: Verify Apache Installation
- Open a browser and navigate to the server's public IP address. You should see the Apache default page.
4. Deploying a Custom HTML Landing Page
Step 1: Create the HTML File
- Open the Apache default directory:
sudo vim /var/www/html/index.html
- Add your custom HTML content:
Step 2: Save and Exit
Step 3: Test the Landing Page
- Open a browser and visit the server’s public IP address.
5. Configuring SSL for HTTPS
Prerequisites:
- Purchase a domain name (e.g.,
yourname.com
). - Update your domain's DNS settings to point to your server's public IP address.
Step 1: Install Certbot
sudo apt install certbot python3-certbot-apache -y
Step 2: Obtain an SSL Certificate
sudo certbot --apache -d yourname.com -d www.yourname.com
Step 3: Verify HTTPS
- Open a browser and navigate to
https://yourname.com
.
Conclusion
This project highlights the essential steps to provision a server, deploy a web server, and secure it with HTTPS. By following this guide, you’ll gain hands-on experience with server management, web hosting, and cloud technologies.
Feel free to customize this project and share your version with the tech community. Let’s keep building and learning together!
Top comments (0)