<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel Okafor</title>
    <description>The latest articles on DEV Community by Emmanuel Okafor (@chikadevops).</description>
    <link>https://dev.to/chikadevops</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2790532%2Fa0537ed1-bebd-4102-ba79-c35e41cd9160.jpg</url>
      <title>DEV Community: Emmanuel Okafor</title>
      <link>https://dev.to/chikadevops</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chikadevops"/>
    <language>en</language>
    <item>
      <title>Deploying a Static Website on AWS with Nginx: The Championship-Winning Goal</title>
      <dc:creator>Emmanuel Okafor</dc:creator>
      <pubDate>Thu, 30 Jan 2025 22:00:49 +0000</pubDate>
      <link>https://dev.to/chikadevops/deploying-a-static-website-on-aws-with-nginx-the-championship-winning-goal-22nm</link>
      <guid>https://dev.to/chikadevops/deploying-a-static-website-on-aws-with-nginx-the-championship-winning-goal-22nm</guid>
      <description>&lt;p&gt;Deploying a website is like scoring the perfect goal-it takes strategy, execution, and precision. Recently I launched a static website on AWS using Nginx, and the whole process felt like setting up the perfect play and scoring the winning goal.&lt;/p&gt;

&lt;p&gt;Here's how I did it, step by step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Goal - Winning Formation
&lt;/h2&gt;

&lt;p&gt;The objective of this project was to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch an Ubuntu EC2 instance on AWS.&lt;/li&gt;
&lt;li&gt;Install and configure Nginx to serve a custom HTML page.&lt;/li&gt;
&lt;li&gt;Ensure accessibility via a public IP address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Play-by-Play Execution
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Launching and EC2 Instance (Picking the Right Stadium)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I started by launching an Ubuntu t2.micro EC2 instance(free-tier eligible), allocated 8GB of EBS storage and attached a pre-configured security group to it, allowing traffic on port 80 (HTTP). Additionally, I deployed the instance in a public subnet and ensured my existing key pair was attached for SSH access. Then I connected to the instance through SSH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Installing Nginx (Putting the Striker in Position)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next was to install Nginx, started the service, and ensured it would automatically start on boot with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, Nginx should be running, and I could confirm this by visiting the public IP address of my EC2 instance in a web browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7xsvzfwq3h5w3wl21tzi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7xsvzfwq3h5w3wl21tzi.png" alt="Image description" width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Uploading Website Files (Passing the ball)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At this point I was ready to create the very simple website file and save it as &lt;em&gt;index.html&lt;/em&gt; using the following command:&lt;br&gt;
&lt;code&gt;echo "[Website content]" &amp;gt;&amp;gt; index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then I copied the &lt;em&gt;index.html&lt;/em&gt; file to /var/www/html/ directory path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Restarting Nginx and Testing the Deployment (Final Whistle: GOAL!)&lt;/strong&gt;&lt;br&gt;
After modifying the index.html file, I restarted Nginx to apply the changes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl restart nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, I accessed my public IP address in a browser, and my custom webpage loaded successfully.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffolvvg7k70tfq087zn0h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffolvvg7k70tfq087zn0h.png" alt="Image description" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges and Solutions
&lt;/h3&gt;

&lt;p&gt;While this was a straightforward task, I encountered a few minor challenges:&lt;/p&gt;

&lt;p&gt;Security Group Configuration: Initially, I couldn’t access the webpage. After troubleshooting, I realized I had to allow inbound HTTP traffic on port 80 in both the Security Group and Network ACL settings.&lt;/p&gt;

&lt;p&gt;Permission Issues: While editing the index.html file, I encountered permission errors. Using &lt;code&gt;sudo&lt;/code&gt; resolved the issue, ensuring I had the necessary privileges.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflections and Key Takeaways
&lt;/h2&gt;

&lt;p&gt;This task served as a great refresher on AWS EC2, security configurations, and web server deployment. Some key lessons learned include:&lt;/p&gt;

&lt;p&gt;Always ensure security group rules settings permit required traffic.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;systemctl enable nginx&lt;/code&gt; ensures the service starts automatically after a reboot.&lt;/p&gt;

&lt;p&gt;Proper file permissions are crucial when modifying files in /var/www/html/.&lt;/p&gt;

&lt;p&gt;For beginners, this exercise provides a solid foundation in cloud computing and DevOps practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Resources
&lt;/h2&gt;

&lt;p&gt;Looking for professional DevOps and Cloud Engineers? Check out:&lt;/p&gt;

&lt;p&gt;DevOps Engineers - &lt;a href="https://hng.tech/hire/devops-engineers" rel="noopener noreferrer"&gt;https://hng.tech/hire/devops-engineers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloud Engineers - &lt;a href="https://hng.tech/hire/cloud-engineers" rel="noopener noreferrer"&gt;https://hng.tech/hire/cloud-engineers&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Deploying a basic Nginx server on AWS is a simple yet essential skill in cloud computing. Whether you're learning DevOps or just starting your cloud journey, practicing such hands-on projects will help reinforce your knowledge.&lt;/p&gt;

&lt;p&gt;Feel free to drop any questions in the comments or share your own experience with setting up Nginx on AWS!&lt;/p&gt;

&lt;p&gt;🚀 Happy Coding!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>tutorial</category>
      <category>cloudcomputing</category>
    </item>
  </channel>
</rss>
