DEV Community

Wycliffe A. Onyango
Wycliffe A. Onyango

Posted on

100 Days of DevOps: Day 15

Successfully Preparing App Server 2 for Application Deployment

I have successfully deployed a new application on App Server 2 in the Stratos Datacenter. Here's a breakdown of the steps I took, the commands I used, and the reasoning behind each action.

Step 1: Installing and Configuring Nginx

First, I needed to install Nginx on the server. I used the sudo yum install -y nginx command to install it since the server uses a Red Hat-based operating system.

I then moved the provided self-signed SSL certificate and key to the /etc/nginx/ directory.

sudo mv /tmp/nautilus.crt /etc/nginx/nautilus.crt
sudo mv /tmp/nautilus.key /etc/nginx/nautilus.key
Enter fullscreen mode Exit fullscreen mode

This was necessary to place the files in a standard, secure location where Nginx could easily find them.

Step 2: Creating the Index Page

To create a simple landing page for verification, I used the echo command to write "Welcome!" into an index.html file in the Nginx document root (/usr/share/nginx/html).

echo "Welcome!" | sudo tee /usr/share/nginx/html/index.html
Enter fullscreen mode Exit fullscreen mode

Using tee with sudo allowed me to write to a file in a privileged directory.

Step 3: Editing the Nginx Configuration

I edited the main Nginx configuration file (/etc/nginx/nginx.conf) to configure the server to listen on ports 80 (HTTP) and 443 (HTTPS). I specified the server name and the paths to the SSL certificate and key.

I had a minor syntax error initially—I forgot a semicolon on the ssl_certificate_key line, which led to a configuration test failure. After adding the semicolon, the test passed.
The command used for the test was sudo nginx -t

Corrected Server Block:

server {
    listen 80;
    listen 443 ssl;
    server_name stapp02.stratos.xfusioncorp.com 172.16.238.11;

    ssl_certificate /etc/nginx/nautilus.crt;
    ssl_certificate_key /etc/nginx/nautilus.key;
    root /usr/share/nginx/html;
    index index.html index.htm;
}
Enter fullscreen mode Exit fullscreen mode

The server_name was set to the server's hostname and IP address so Nginx would respond to requests from the correct location.

Step 4: Verification and Final Testing

After restarting Nginx with sudo systemctl restart nginx, I ran a final test from the jump host. Initially, I made a small error using curl -IK, but I quickly realized I needed to use the lowercase -k flag to accept the self-signed certificate.

The final command and its output confirmed my success:

curl -Ik https://172.16.238.11/
Enter fullscreen mode Exit fullscreen mode

Result:

HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Mon, 18 Aug 2025 04:01:57 GMT
Content-Type: text/html
Content-Length: 9
...
Enter fullscreen mode Exit fullscreen mode

The HTTP/1.1 200 OK status code proved that the server was correctly configured to handle HTTPS requests and serve the index.html file.

Top comments (0)