How to Set Up Apache Web Server in AWS EC2 Linux (Ubuntu) Instance?
Last Updated :
10 Apr, 2025
In this article, we will look into the process of setting up Apache Web Server in AWS EC2 Linux Instance.This tutorial has been done on a system running Windows 10 Home (Version 20H2).
Implementation:
The steps taken to complete this tutorial are being stated below:
Step 1: Go to portal.aws.amazon.com to create a new AWS account. Provide email address and password. Click Continue.

Step 2: Provide other details like Name, Phone Number, etc., and click Continue when done.

Step 3: Provide billing information and click ‘Verify and Continue’.

Step 4: Confirm your identity and click ‘Send SMS’. Confirm the OTP.

Step 5: Select a plan. Here, we choose ‘Basic support – Free’ and click on ‘Complete sign up’.

Step 6: AWS account has been successfully created. Click ‘Go to the AWS Management Console.

Step 7: Click on My Account > AWS Management Console.

Step 8: Sign in as Root User.

Step 9: Navigate to Services and select EC2 under Compute category.

Step 10: On the left pane, click on Instances under the Instances section. Click ‘Launch instances’.

Step 11: Now, we choose an Amazon Machine Image (AMI). Search for ‘ubuntu server 18.04 LTS’ and click Select.

Step 12: Choose Instance Type. Here, we have chosen ‘t2.micro which’ is Free tier eligible. Click ‘Next: Configure Instance Details.

Step 13: Don’t change anything and click ‘Next: Add Storage.

Step 14: Set the size as 8 GiB and click ‘Next: Add Tags’.

Step 15: Click ‘Next: Configure Security Group’.

Step 16: Choose ‘Create a new security group’ and add SSH, HTTP, and HTTPS Types. Click ‘Review and Launch’ when done.

Step 17: Click Launch.

Step 18: Select ‘Create a new key pair’ and enter any key pair name in the given field. Leave the ‘Key pair type’ as RSA. Click ‘Download Key Pair’ to download the .pem file. Store it in a secure location as it will be used later. Click ‘Launch Instances’.

Step 19: Click ‘View Instances’.

Step 20: We can now see our instance named ‘inst1’ running.

Step 21: Go to putty.org to download PuTTY. Click on ‘here’.

Step 22: Under MSI (‘Windows Installer’) click the first link (next to 64-bit x86) to download PuTTY.

Step 23: Go to puttygen.com to download PuTTYgen. Click on ‘PuTTY Installation Download page’.

Step 24: Under ‘puttygen.exe’ section click the ‘puttygen.exe’ link next to 64-bit to download it.

Step 25: Launch the setup to install PuTTY. Click Next.

Step 26: Specify the install location for PuTTY. Click Next.

Step 27: Click Install.

Step 28: After installing PuTTY, launch the PuTTYgen software. The following window appears.

Step 29: Click File > Load private key.

Step 30: Select the previously downloaded .pem file (ubuntuKey.pem) and click Open.

Step 31: Click Ok.

Step 32: Click ‘Save private key’.

Step 33: Enter a name for the generated .ppk file and click Save.

Step 34: Open PuTTY and enter the public IP of the instance in Host Name filed and keep Port as 22.

Step 35: Select Auth under SSH and click on Browse.

Step 36: Select the .ppk file (ubuntuppk.ppk) and click Open.

Step 37: Click Accept.

Step 38: Login as ‘ubuntu’.

Step 39: Ubuntu has started as we can see below.

Step 40: Update packages with the command ‘sudo apt-get update'.

Step 41: Install Apache2 using ‘sudo apt-get install apache2’.

Step 42: Verify that Apache is running using the command ‘sudo systemctl status apache2’.

Step 43: Copy the public IP of the EC2 instance and paste it on a browser of the host OS.

Step 44: The Apache2 Ubuntu Default Page appears.

Step 45: cd into /var/www/html and open the index.html file in the nano editor.

Step 46: This is the default code. We need to replace this code with our own code for the sample webpage.

Step 47: The default code is replaced with our own code in index.html. Save and exit the editor.

Step 48: We can verify that we are able to access the hosted webpage using ‘curl’ inside the instance.

Step 49: The hosted web page can also be accessed from the host OS as shown.

Step 50: The hosted web page can also be accessed by another system (a smartphone – iOS 14.7.1) as shown.
Similar Reads
How to Install Apache Web Server in Linux: Ubuntu, Fedora, RHEL?
If you're looking to install Apache on Linux, this guide will walk you through the steps required for different distributions, including Ubuntu, Fedora, and RHEL. The Apache web server is a popular choice for hosting websites and applications, known for its reliability and flexibility. Whether you'r
5 min read
How to Set Up a Mail Server with Postfix and Dovecot on Ubuntu?
If you are running a Small Business or have a Personal Website, then the Development of a Personal Mail Server will become essential. To Set Up Mail Server on Ubuntu, you need to use Postfix and Dovecot Tools.Postfix and Dovecot on Ubuntu are essential to Send and Receive Emails in a Mail Server. Th
5 min read
How to Install Apache Web Server on Linux Cloud Server?
Apache is an open-source web server used widely for hosting websites and web applications. It's popular on the internet and supports platforms like Linux, Windows, and macOS. Installing Apache on a Linux-based cloud server is straightforward. Cloud servers offer flexibility and scalability, enabling
5 min read
How to install Ansible in AWS EC2 Server ?
Ansible is an automation tool which helps in managing the configuration over multiple machines . On the other hand AWS EC2 is a web service which allows users to rent any required virtual server . Here in this guide, we will first discuss what is Ansible. Then we will discuss AWS EC2 Service. After
5 min read
How To Install the Apache Web Server on Debian 11?
Apache is an open-source web server thatâs available for Linux servers free of charge. Installing an Apache web server on Linux is a straightforward process. In this article, we will install Apache Web Server Debian 11 (Bullseye). Steps to Install Apache Web Server in LinuxStep 1: Update Your System
3 min read
How To Install the Apache Web Server on CentOS 7
Apache Web Server, commonly known as Apache is a free, open-source, and one of the most widely used web servers in the world. Apache web server is developed and maintained by Apache Software Foundation. Apache is not any physical server, it is a software application running either on a physical/virt
4 min read
How to Setup Virtual Hosts with Apache Web Server on Linux?
Setting up a virtual host in Apache web server on Linux allows us to host multiple websites on a single server. This virtual host is useful when one wants to host multiple projects for businesses managing multiple domains with a single server.PrerequisitesApache server installed.Root or sudo accessS
2 min read
How to Install and Set up a WAMP Server ?
Windows, Apache, MySQL and PHP is commonly abbreviated as WAMP. Some people may confuse with LAMP but the only difference between the two is their operating systems. In case of LAMP, L stands for Linux. Setting up a server included the installation of all the software listed in the abbreviation. Ano
3 min read
How to install and configure Nginx Web Server on Godaddy VPS (Ubuntu)?
GoDaddy Server is a cloud-based hosting platform that consists of virtual and dedicated servers. The premium service includes weekly backups, 99% uptime, 24x7 Customer Support, a free encrypted SSL certificate, unlimited bandwidth, and SSD storage. For regular users, the latest generation is VPS Gen
2 min read
How to install and set up Apache Virtual Hosts on Ubuntu?
Every website that is published on the Internet is housed on a web server (host), which is able to handle requests for web pages made by clients using browsers like Chrome, Firefox, or Internet Explorer and is connected to the network with a public IP address. Install a web server before hosting a w
4 min read