Launch an EC2 Instance
Go to the AWS Management Console.
Launch a new EC2 instance.
Choose the Amazon Machine Image (AMI) as Amazon Linux 2.
Select the instance type (e.g., t2.micro for free tier).
Configure the instance details, add storage, and configure the security group to allow HTTP (port 80) and SSH (port 22) access.
Launch the instance and connect to it using SSH.
Connect to Your EC2 Instance
ssh -i “your-key-pair.pem” ec2-user@your-ec2-public-dns
Update the Package Index
sudo yum update -y
Install Nginx
sudo amazon-linux-extras install nginx1.12 -y
Start and Enable Nginx:
sudo systemctl start nginx
sudo systemctl enable nginx
Read More about Nginx
ThankYou
https://devopsden.io/article/how-to-install-nginx-on-ec2-instance