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
An active Amazon Web Services Account(even a free tier can do the magic).
A personal machine is installed with any popular OS(used to access the cloud via a terminal).
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
Switch to the Root user
Sudo su -
Update and upgrade your machine.
apt-get update -y && apt-get upgrade
Install Nginx
apt-get install -y nginx
Confirm Your Nginx is installed
systemctl status nginx
Start your NGINX server if not running(optional)
systemctl start nginx
Copy and paste your Amazon EC2 instance into your Browser to confirm the server is running.
Part 2: NGINX Default page customization
Using your favorite terminal editor, open the index.html file below.
vi /var/www/html/index.html
Edit the file to match the welcome message below.
Format
Welcome to DevOps stage 0 - [Full name]/[slack username]
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
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
