<?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: Kemdirim Njoku</title>
    <description>The latest articles on DEV Community by Kemdirim Njoku (@k_e_m).</description>
    <link>https://dev.to/k_e_m</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2802753%2F34c2417f-c706-4ac2-b7fe-4fb2b8676b14.png</url>
      <title>DEV Community: Kemdirim Njoku</title>
      <link>https://dev.to/k_e_m</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/k_e_m"/>
    <language>en</language>
    <item>
      <title>NGINX Configuration</title>
      <dc:creator>Kemdirim Njoku</dc:creator>
      <pubDate>Sat, 01 Feb 2025 21:28:06 +0000</pubDate>
      <link>https://dev.to/k_e_m/nginx-configuration-58na</link>
      <guid>https://dev.to/k_e_m/nginx-configuration-58na</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In this blog post, I share my experience with the DevOps Stage 0 - NGINX Configuration task. This task required me to set up and configure NGINX on a fresh Ubuntu server, serving a custom HTML page as the default page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Approach:&lt;/strong&gt;&lt;br&gt;
To complete this task, I followed this step-by-step approach:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1: Create an AWS EC2 Instance&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Log in to the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to the EC2 dashboard.&lt;/li&gt;
&lt;li&gt;Click "Launch Instance" and choose "Ubuntu Server 24.04 LTS (HVM), SSD Volume Type" as Amazon Machine Image .&lt;/li&gt;
&lt;li&gt;Choose the “t2.micro” instance type.&lt;/li&gt;
&lt;li&gt;Create a new key pair (I named mine “hng12” and left other options as default).&lt;/li&gt;
&lt;li&gt;Download and save the .pem file in a secure and accessible directory.&lt;/li&gt;
&lt;li&gt;Create a new security group and allow inbound SSH and HTTP traffic from all sources (0.0.0.0/0)&lt;/li&gt;
&lt;li&gt;Leave all other options as is and Launch the instance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Step 2: Install NGINX&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connect to the EC2 instance using the “EC2 Instance Connect” option.&lt;/li&gt;
&lt;li&gt;Update the package list: sudo apt update&lt;/li&gt;
&lt;li&gt;Install NGINX: sudo apt install nginx&lt;/li&gt;
&lt;li&gt;Verify NGINX installation: nginx -v&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Step 3: Configure NGINX&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new file in the /var/www/html/ directory: sudo nano /var/www/html/index.html&lt;/li&gt;
&lt;li&gt;Add the following HTML code to the file:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&amp;lt;html&amp;gt;&lt;br&gt;
&amp;lt;head&amp;gt;&lt;br&gt;
    &amp;lt;title&amp;gt;Welcome to DevOps Stage 0&amp;lt;/title&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;&lt;br&gt;
    &amp;lt;h1&amp;gt;Welcome to DevOps Stage 0 - Kemdirim Njoku/Kemystery&amp;lt;/h1&amp;gt;&lt;br&gt;
&amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Replace [Kemdirim Njoku] and [Kemystery] with your actual name and Slack username.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the NGINX configuration file: sudo nano /etc/nginx/sites-available/default&lt;/li&gt;
&lt;li&gt;Confirm that the content of the configuration file is serving the custom HTML page:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;`server {&lt;br&gt;
    listen 80;&lt;br&gt;
    server_name _;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root /var/www/html;
index index.html index.htm;

location / {
    try_files $uri $uri/ =404;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Restart NGINX to apply the changes: sudo service nginx restart&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Step 5: Test the Configuration&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get the public IP address of the EC2 instance. In my case: 44.212.56.112&lt;/li&gt;
&lt;li&gt;Access the public IP address in a web browser: &lt;a href="http://44.212.56.112/" rel="noopener noreferrer"&gt;http://44.212.56.112/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Verify that the custom HTML page is displayed with the correct message.&lt;/li&gt;
&lt;/ol&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%2Fv4arwgxph7sf3q345ae8.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%2Fv4arwgxph7sf3q345ae8.png" alt="Image description" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges and Solutions&lt;/strong&gt;&lt;br&gt;
During this task, I encountered a few challenges:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;NGINX configuration: I had to learn about NGINX configuration files and how to update them to serve a custom HTML page.&lt;/li&gt;
&lt;li&gt;HTML syntax: I had to ensure that the HTML code I wrote was correct and would display the message as expected.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To overcome these challenges, I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Referenced online documentation: I consulted the official NGINX documentation and other online resources to learn about NGINX configuration files.&lt;/li&gt;
&lt;li&gt;Used online HTML validators: I used online HTML validators to ensure that my HTML code was correct and would display the message as expected.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Completing this task helped me gain hands-on experience with NGINX configuration and HTML syntax. I learned how to set up and configure NGINX on a fresh Ubuntu server, serving a custom HTML page as the default page.&lt;br&gt;
This task contributes to my learning and professional goals by:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Improving my DevOps skills: I gained experience with NGINX configuration, which is an essential skill for DevOps engineers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enhancing my problem-solving skills: I learned how to overcome challenges and debug issues during the task.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>aws</category>
      <category>tech</category>
    </item>
  </channel>
</rss>
