Configure NGINX on your Ubuntu Server in AWS

Introduction

Even after the emergency of cloud computing, organizations and companies are still using the foundational software and services, but with enhancements of these services in the cloud and efficient deployment. So, in this article, I will give you a step-by-step guide on how to deploy your NGINX server in an AWS EC2 instance running an Ubuntu OS.

Prerequisites

  1. An active Amazon Web Services Account(even a free tier can do the magic).

  2. A personal machine is installed with any popular OS(used to access the cloud via a terminal).

  3. Beginner to intermediate-level Linux skills and AWS Cloud.

Task Steps

i). Open AWS Account free tier(optional)

ii). Log into AWS Console using your favourite Browser if you already have an account.

iii). Then, Spin up an EC2 instance with Ubuntu OS.

iv). Ensure you create SSH keys and add the security group to allow HTTP & SSH traffic to your

Part 1:-NGINX installation

1. Connect to your EC2 instance using SSH

Syntax

Ssh -i “key” username@domain/public-ip

  1. Switch to the Root user

    Sudo su -

  2. Update and upgrade your machine.

    apt-get update -y && apt-get upgrade

  3. Install Nginx

    apt-get install -y nginx

  4. Confirm Your Nginx is installed

    systemctl status nginx

  5. Start your NGINX server if not running(optional)

    systemctl start nginx

  6. Copy and paste your Amazon EC2 instance into your Browser to confirm the server is running.

    Part 2: NGINX Default page customization

    1. Using your favorite terminal editor, open the index.html file below.
      vi /var/www/html/index.html

    2. Edit the file to match the welcome message below.

      Format

      Welcome to DevOps stage 0 - [Full name]/[slack username]

    3. Save the file and refresh your Browser

      Conclusion

      Finally, in this blog, we have been able to spin an EC2 instance in AWS and install NGINX Server before customizing the default page to match our custom Text. As you can see, it’s easy to get started in the cloud by deploying your servers and dependencies. I encourage you to try the same using other cloud providers out there and experience the true power of the cloud.

References & Further Reading

DevOps Engineers

Cloud Engineers

Nginx Beginner’s Guide

Get started with Amazon EC2

1
Subscribe to my newsletter

Read articles from Major Kiema Mbandi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Major Kiema Mbandi
Major Kiema Mbandi