Deploying a web server on the cloud is easier than ever, especially with AWS. In this article, I’ll walk you through the steps I took to install NGINX on an Ubuntu-based EC2 instance using AWS.
Before starting, ensure you have:
- An AWS account: If you dont have an AWS account, you can simply register at https://amazon.aws.com
and if you have an account, login using your root email.
once you are logged in,
- Create an EC2 Instance: Search for Instance on the search bar and click on launch instance
To create your instance, do the following
a. Type your instance name e.g my_nginx_instance note: do not put in spaces in between your instance name.
b. Select Ubuntu as your OS (Operating System)
c. Select your instance type and choose t3.micro for the purpose of our testing and this article.
d. Create your keypair: Keypairs are very important and must be kept and saved. You can either use an existing keypair if you have or create a new keypair
e.Next is to create your security group. For the purpose of this article..kindly select allow SSH from anywhere and Allow SSH from internet.
f. Then click on Launch Instance.
- Open your Gitbash and we can run some commands from the terminal.
- Make sure to change directory to where your keypair was downloaded. As for me, my keypair is currently downloaded in my downloads folder. so i am going to cd into downloads.
- SSh into your Ec2 Instance
- Update your ubuntu OS: sudo apt update -y
- Next is to install Nginx: sudo apt install nginx -y
- Next is to start your Nginx: sudo systemctl start nginx
- You can check status of your Nginx: sudo systemctl status nginx
- Next is to enable Nginx: sudo systemctl enable nginx
- Access your Ip address and you will get to see Nginx Landing page
- You can go ahead to modify the landing page to your own words or text. using sudo nano /var/www/html/index.nginx-debian.html
I hope i was able to take you through my basic step in setting up an nginx server on an AWS instance.
Thank you.
Top comments (0)