Install Nginx in AWS Ubuntu 20.04

Install Nginx in AWS Ubuntu 20.04

  1. Click on Launch Instances

Image description

  1. Add Server Details
  • Enter Server name

  • Select OS Image here we select Ubuntu 22.04

  • Create a key pair file this will be used for SSH login

Image description

Image description

  1. Configure network setting
  • Select create security group if you have existing you can select your existing security group also

  • Allow SSH traffic from Anywhere for security best practise allow your or specific List of IP

  • Select Allow both HTTP & HTTPS traffic from internet

Image description

Create Elastic IP

Normal EC2 server if restart or Reboot then there Public IP will always change there for we are creating Elastic IP separately

  1. Click on Allocate Elastic IP address

    Image description

  2. Click on Allocate

    Image description

  3. Click on Associate Elastic IP

    Image description

  4. Select that created Ec2 server from List

    Image description

  5. Here you can check that Elastic IP

    Image description

Connect to SSH

chmod 400 TestServer.cer
sudo ssh -i TestServer.cer ubuntu@54.205.12.196

Install Nginx

sudo apt update #Update ubuntu server
sudo apt install -y nginx #install nginx 

#others command
sudo systemctl status nginx #check nginx status
sudo systemctl restart nginx #restart nginx service