AWS Nginx Server Setup Using Linux EC2 Instance
AWS Nginx Server Setup Using Linux EC2 Instance
• Navigate to Services, click on it, Select Compute section in it, Navigate to EC2 in it and click on
it
• You will re-directed to EC2 Dashboard, you can see launch instance button on the dashboard,
click on it
• Give a name to your instance, choose AMI image as Linux os, keep instance type and
architecture as default
• Create a key pair, select that key pair
• In network settings, click on edit, rename security group name, leave others for now we’ll see
it later
• Click on launch instance
• Wait for some time for instance to be created and running stage, your instance is created
Step 2: Connecting to the internet
❖ After instance starts running, click on connect at top, in “EC2 Instance connect” do not do
anything and click on connect, you’ll be connected to the internet with your instance.
Step 3: Connecting to local system using ssh client
❖ Go back to instance click on connect, this time go for ssh client
❖ Then open PowerShell, go to the directory where you downloaded key-pair file which is a
.pem file (ex: Linux.pem)
❖ Now copy paste the ssh client address link in powershell
❖ Type “yes”, then your connection will be established, type sudo su for checking if root user
comes up then you have successfully connected.
Step 4: Installing and Accessing Nginx Server
• All you have to do is type these commands in order
• Sudo su
• sudo yum update -y
• sudo yum install nginx -y
• sudo systemctl start nginx
• sudo systemctl enable nginx
• now you can go and enter your public ip address of the instance and see that nginx server
page is accessible and working, that same ip address can be used anywhere by anyone if they
want and as long as instance is running then we can access that page.
• If the page is not loading that means we have not enabled http or https networks, go back to
your instance
• Click on security group, click on the security group link, click on inbound rules
• Here you need to add http and https networks and ip address to anywhere
• Now you can access it
• using the sudo nano command you’ll be able to access nginx html page and you can do
changes there
• refresh the page now you can see the changes happening
Step 5: Exit and Terminate the instance
• exit by typing exit in the PowerShell or instance
• definitely terminate the instance