<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Hosting a Static Website on AWS EC2]]></title><description><![CDATA[Hosting a Static Website on AWS EC2]]></description><link>https://hosting-a-static-website-on-aws-ec2.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 24 Jun 2026 06:04:22 GMT</lastBuildDate><atom:link href="https://hosting-a-static-website-on-aws-ec2.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Installing Apache2 Web Server and Host a Static Website on AWS EC2]]></title><description><![CDATA[This Blog contains step-by-step instructions for installing an Apache2 web server on an EC2 instance updating, installing, configuring security groups, and accessing via the public IP.
Prerequisites:-
Before we get started, ensure you have the follow...]]></description><link>https://hosting-a-static-website-on-aws-ec2.hashnode.dev/installing-apache2-web-server-and-host-a-static-website-on-aws-ec2</link><guid isPermaLink="true">https://hosting-a-static-website-on-aws-ec2.hashnode.dev/installing-apache2-web-server-and-host-a-static-website-on-aws-ec2</guid><category><![CDATA[Hosting a Static Website on AWS EC2]]></category><category><![CDATA[Static Website]]></category><category><![CDATA[AWS]]></category><category><![CDATA[EC2 instance]]></category><dc:creator><![CDATA[Iqbal Shaikh]]></dc:creator><pubDate>Mon, 21 Jul 2025 06:59:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1753081302430/828495aa-cac7-4bd5-94a7-9f06cc7d3f30.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This Blog contains step-by-step instructions for installing an Apache2 web server on an EC2 instance updating, installing, configuring security groups, and accessing via the public IP.</p>
<h3 id="heading-prerequisites"><strong>Prerequisites:-</strong></h3>
<p>Before we get started, ensure you have the following:</p>
<ul>
<li><p>An active AWS account</p>
</li>
<li><p>(Optional )A basic understanding of EC2, security groups, and static websites.</p>
</li>
</ul>
<h3 id="heading-steps-to-launch-and-connect-to-an-ec2-instance"><strong>Steps to Launch and connect to an EC2 Instance.</strong></h3>
<p>You need to create an EC2 instance. For Detailed steps <mark>Click </mark> <a target="_blank" href="https://learn-tech-in-30mins.hashnode.dev/aws-creating-and-connecting-to-your-first-virtual-machine-using-ec2"><strong><mark>here</mark></strong></a></p>
<h3 id="heading-steps-for-hosting-a-static-website-on-aws-ec2"><strong>Steps for Hosting a Static Website on AWS EC2.</strong></h3>
<ol>
<li><p>Log in to the <strong>EC2 Linux instance</strong> by connecting through AWS default <strong>EC2 instance connect.</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753075173072/d332619f-2ea9-47a2-b266-9fe98390b9bc.png" alt class="image--center mx-auto" /></p>
<ol start="2">
<li>Use <strong><em><mark>sudo</mark></em></strong> to switch from <strong><em><mark>ubuntu to root</mark></em></strong> for administrative tasks on EC2 Instance to mitigate the risk of unintended alterations affecting system stability or security.</li>
</ol>
</li>
</ol>
<p>    <strong><mark>Type sudo su to switch from ubuntu to root; followed by pressing Enter</mark></strong></p>
<p>    <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753077404311/e1b3ba5a-ff48-4681-bc2b-212c770de65e.png" alt class="image--center mx-auto" /></p>
<ol start="3">
<li>After sudo-ing to the root user <strong><em>execute</em></strong> <em>the command</em> <strong><em><mark>apt update</mark></em></strong> <strong><em><mark>followed by pressing Enter</mark></em></strong> to install any pending updates</li>
</ol>
<p>    <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753077637256/4c3739c9-f052-430c-8bd9-27110c776caf.png" alt class="image--center mx-auto" /></p>
<ol start="4">
<li>Execute the command <strong><mark>apt install apache2 -y</mark></strong> <strong><mark>followed by pressing Enter</mark></strong> to install the apache2 web server on the <strong>Ubuntu Instance</strong></li>
</ol>
<p>    <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753077936029/0f97128d-d6de-4dfc-88f1-559410cafc9e.png" alt class="image--center mx-auto" /></p>
<ol start="5">
<li><p>Start Apache: Execute the command <strong><mark>systemctl start apache2 followed by pressing Enter</mark></strong></p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753079171196/4c9cca42-5381-4884-a64d-d323440c0959.png" alt class="image--center mx-auto" /></p>
<p> <strong><mark>Enable Apache to start on boot:</mark></strong></p>
<p> Execute command <strong><mark>systemctl enable apache2</mark> followed by pressing Enter.</strong></p>
<p> Execute command <strong><mark>systemctl status apache2</mark> followed by pressing Enter.</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753079342990/0e0bab0d-ec02-4d7e-9993-da6ceab0dfae.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753079510750/a7af12e9-3450-4083-bb36-c765ae84e576.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Use this command <mark>echo "It works" &gt; /var/www/html/index.html</mark> to create the HTML file.</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753079571182/9937b6a0-9fa3-4bd2-9ed3-1b3aa0453312.png" alt class="image--center mx-auto" /></p>
<p> <strong><mark>Test Your Website</mark></strong></p>
<p> Now that everything is set up, open a web browser(chrome) and visit your EC2 instance’s public IP (e.g., <a target="_blank" href="http://your-public-ip"><code>http://your-public-ip</code></a>). If everything is configured correctly, your static website should appear.</p>
<p> In this Case <strong><mark>http://34.227.143.10.</mark></strong></p>
</li>
</ol>
<p>    <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753080013108/d06b1f4c-f472-4420-827b-305470fbe676.png" alt class="image--center mx-auto" /></p>
<p>    <strong><mark>Congratulations on Installing and hosting static website an Apache2 Web Server on EC2! Good job!</mark></strong></p>
<p>    <a target="_blank" href="https://learn-tech-in-30mins.hashnode.dev/aws-creating-and-connecting-to-your-first-virtual-machine-using-ec2"><strong><mark>How to Create an EC2 instance / Virtual Machine with an Ubuntu AMI on AWS: A Step-by-Step Beginner’s Guide Click here</mark></strong></a></p>
<p>    <a target="_blank" href="https://create-your-aws-account.hashnode.dev/how-to-create-your-aws-account-in-easy-simple-steps-for-free">How to Create Your AWS Free Tier Account 2025</a></p>
]]></content:encoded></item></channel></rss>