Filipino DevOps Engineer – Portfolio Weblog

Embracing continuing self-education and training aligned with helping do DevOps work to serve others

Day 16 of 100 Days of DevOps – with Kode Kloud engineer program – Install and configure Nginx server as a Latency mitigation service

Hi, folks. Hello there!

How are you?

Greetings to all, and a good afternoon!

I hope you’re feeling well, and good this warm afternoon. Well, for me over here – weather’s becoming warmer with the onset of lunchtime.

Sorry, I haven’t been turning-on my room’s air-conditioning unit for some time now – to also help save on electricity cost. Especially, while I’m unemployed – I have to help keep costs down a little.

Anyway, going beyond this…

My friends, for today we have a new task from teachers and our other smart friends at Kode Kloud academy.

Kindly refer to the following task briefing:

Day by day traffic is increasing on one of the websites managed by the Nautilus production support team. Therefore, the team has observed a degradation in website performance. Following discussions about this issue, the team has decided to deploy this application on a high availability stack i.e on Nautilus infra in Stratos DC. They started the migration last month and it is almost done, as only the LBR server configuration is pending. Configure LBR server as per the information given below:

a. Install nginx on LBR (load balancer) server.

b. Configure load-balancing with the an http context making use of all App Servers. Ensure that you update only the main Nginx configuration file located at /etc/nginx/nginx.conf.

c. Make sure you do not update the apache port that is already defined in the apache configuration on all app servers, also make sure apache service is up and running on all app servers.

d. Once done, you can access the website using StaticApp button on the top bar.


Hi folks, how do you do?

Good morning!

Alright, let’s get started with our task from Kode Kloud.

Thank you, my friends – for being with me.


SSH, or log into our LBR server

ssh loki@172.16.238.14

For necessary context, our resources infrastructure details can be found at the following table:

Enter our server password.

Then, we should be able to login.

It may be prudent to check our LBR server’s Linux distribution, my friends.

With this, we do the following:

cat /etc/os-release

This should enable us to see more information about the kind of Linux OS we have from our latency mitigation server (LBR).

Okay, with this one – we’re on a Linux instance that’s running a CentOS version 9.

Alright, good.

Now with this information, my brothers and sisters, we need to install necessary software.


Install Nginx server

sudo dnf install nginx -y

We’ll need to ask Linux to install Nginx, and then wait for the system to finish doing its thing.

Okay, we’re done with our Nginx install. Now folks, we’ll need to configure our software, or server, in this case.

Before we do that, please start your Nginx server, and then enable auto-start upon Linux boot.

sudo systemctl start nginx && sudo systemctl enable nginx

Configure our Nginx server

Next, my friends we need to check and make modifications (in my case, I’m working with a text-editor app called “vi”. Folks, there’s other text-editor apps available) to a conf (meaning: configurations) file at this Linux path (/etc/nginx/nginx.conf).

/etc/nginx/nginx.conf

Folks, usually the folder or directory at (/etc/) holds configuration files for software we have installed on our Linux instance.

Okay.

cat /etc/nginx/nginx.conf | grep include

We need to look for the include clause from our defaults conf file. So that we can append and annex a new conf file. Without modifying our default conf file.

In this case, our append or include conf path is this one:

/etc/nginx/conf.d/*.conf

Next, my friends, we need to create a new conf file (named: “resource-web-servers.conf”). An empty one first, then we write our new settings to be appended with our defaults.

touch /etc/nginx/conf.d/resource-web-servers.conf

Since our Apache software from our web app servers (from stapp01 to stapp03) listens on port “8088”.

We’ll need to write a separate conf (configurations) file. One which will append to the default Nginx conf file.

# Define the upstream group with all app servers
upstream app_servers {
    server stapp01:8088;
    server stapp02:8088;
    server stapp03:8088;
}

server {
    listen 80;
    server_name 172.16.238.10 172.16.238.11 172.16.238.12;

    location / {
        # Pass requests to the upstream group
        proxy_pass http://app_servers;
        # Include these headers to pass client information
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Next, we need to check our Nginx conf file for errors with the following Linux command:

sudo nginx -t

If and when it checks out without any errors thrown off.

Folks, we’ll need to restart our Nginx service.

sudo systemctl restart nginx

Okay, we’ve restarted our Nginx server.

Now, for good measure we first need to check the status of our Nginx service.

sudo systemctl status nginx

Sorry folks, we failed at this try. Our app is accessible. However, we didn’t get it all right this time.

Our web app is accessible, through our latency server’s Nginx (which is good). We see this “welcome” message accessing our app from a web browser.

However, when we let Kode Kloud check our work.

Oh noes! 🤖

We got a task correctness error. Sorry, folks!

We’ll need to try again later.

According to the error stream. While our app is accessible and working fine. It isn’t being coursed through all our web app servers. Maybe just one or two. We need to have three servers working together for our task to be correct.

For now, I need to get something to eat. I’m already literally hungry. Catch you folks later, okay? I need to go have some breakfast.

Thanks!


Folks, I’ll work on this one again tomorrow, okay? Sorry.

For now, I need to focus on getting myself ready for something that’s also requiring time and effort.

Thank you all, my dear brothers and sisters in Christ.

God bless us all, and every one else.


Rework: September 28, 2025 – Day 16 of 100 Days of DevOps – Latency mitigation service through load balancer

Folks! How are you doing over where you’re at, my friends?

Good evening from our side over here.

I hope every one’s doing well right now.

Okay. Let’s do a rework for our Day 16 task.

We set configurations and append these to our defaults.

Going forward, folks, we’ve had another failure. Sorry. This was the result from after we’ve ran our task checker.

We’re doing something wrong along the way.

I feel the conf file for our Nginx fails to satisfy a correctness criteria from our folks at Kode Kloud. This means, that while our app works fine. It isn’t behaving the way it should when load is given or applied to our system.

We’ll need to try again, alright folks?


Attempt 03: 29th September, 2025

Alright, let’s try again folks.

upstream app_servers {
server stapp01.stratos.xfusioncorp.com:[port number];
server stapp02.stratos.xfusioncorp.com:[port number];
server stapp03.stratos.xfusioncorp.com:[port number];
}
server {
listen 80; # "Avoid using a port that conflicts with other ports in the configuration file by changing it to a unique port number."
listen [::]:80;
server_name _;
location / {
proxy_pass http://app_servers;
}
error_page 404 /404.html;
location = /404.html {}
error_page 500 502 503 504 /50x.html;
location = /50x.html {}
}

Folks, I found this conf file – which looks similar to what we’ve been putting across from our earlier attempts, that sadly failed.

We’ve been doing something wrong. It seems our conf file is missing a few things. And we also need to remove a bunch of other things, too.

Off the Kode Kloud forum (citing resource: https://kodekloud.com/community/t/day-16-install-and-configure-nginx-as-an-lbr/482227/4)

And after doing the same steps shown above.

Our load balancer is working. With our web app accessible through a web browser.

Folks, thankfully – we’ve now cleared our task for Day 16!

Congrats, every body!! 🎉

Good job!

We’ve finally passed through the Kode Kloud correctness checker.

Thanks for being around with me, my friends.

We’ll now move on our Day 17 task.

God bless.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.