In this article, we will look into the process of setting up Apache Web Server in AWS EC2 Linux Instance.This tutorial has been done on a system running Windows 10 Home (Version 20H2) .
Implementation:
The steps taken to complete this tutorial are being stated below:
Step 1: Go to portal.aws.amazon.com to create a new AWS account. Provide email address and password. Click Continue.
Step 2: Provide other details like Name, Phone Number, etc., and click Continue when done.
Step 3: Provide billing information and click âVerify and Continueâ.
Step 4: Confirm your identity and click âSend SMSâ. Confirm the OTP.
Step 5: Select a plan. Here, we choose âBasic support â Freeâ and click on âComplete sign upâ.
Step 6: AWS account has been successfully created. Click âGo to the AWS Management Console.
Step 7: Click on My Account > AWS Management Console.
Step 8: Sign in as Root User.
Step 9: Navigate to Services and select EC2 under Compute category.
Step 10: On the left pane, click on Instances under the Instances section. Click âLaunch instancesâ.
Step 11: Now, we choose an Amazon Machine Image (AMI). Search for âubuntu server 18.04 LTSâ and click Select.
Step 12: Choose Instance Type. Here, we have chosen ât2.micro whichâ is Free tier eligible. Click âNext: Configure Instance Details.
Step 13: Donât change anything and click âNext: Add Storage.
Step 14: Set the size as 8 GiB and click âNext: Add Tagsâ.
Step 15: Click âNext: Configure Security Groupâ.
Step 16: Choose âCreate a new security groupâ and add SSH, HTTP, and HTTPS Types. Click âReview and Launchâ when done.
Step 17: Click Launch.
Step 18: Select âCreate a new key pairâ and enter any key pair name in the given field. Leave the âKey pair typeâ as RSA. Click âDownload Key Pairâ to download the .pem file. Store it in a secure location as it will be used later. Click âLaunch Instancesâ.
Step 19: Click âView Instancesâ.
Step 20: We can now see our instance named âinst1â running.
Step 21: Go to putty.org to download PuTTY. Click on âhereâ.
Step 22: Under MSI (âWindows Installerâ) click the first link (next to 64-bit x86) to download PuTTY.
Step 23: Go to puttygen.com to download PuTTYgen. Click on âPuTTY Installation Download pageâ.
Step 24: Under âputtygen.exeâ section click the âputtygen.exeâ link next to 64-bit to download it.
Step 25: Launch the setup to install PuTTY. Click Next.
Step 26: Specify the install location for PuTTY. Click Next.
Step 27: Click Install.
Step 28: After installing PuTTY, launch the PuTTYgen software. The following window appears.
Step 29: Click File > Load private key.
Step 30: Select the previously downloaded .pem file (ubuntuKey.pem) and click Open.
Step 31: Click Ok.
Step 32: Click âSave private keyâ.
Step 33: Enter a name for the generated .ppk file and click Save.
Step 34: Open PuTTY and enter the public IP of the instance in Host Name filed and keep Port as 22.
Step 35: Select Auth under SSH and click on Browse.
Step 36: Select the .ppk file (ubuntuppk.ppk) and click Open.
Step 37: Click Accept.
Step 38: Login as âubuntuâ.
Step 39: Ubuntu has started as we can see below.
Step 40: Update packages with the command âsudo apt-get update’.
Step 41: Install Apache2 using âsudo apt-get install apache2â.
Step 42: Verify that Apache is running using the command âsudo systemctl status apache2â.
Step 43: Copy the public IP of the EC2 instance and paste it on a browser of the host OS.
Step 44: The Apache2 Ubuntu Default Page appears.
Step 45: cd into /var/www/html and open the index.html file in the nano editor.
Step 46: This is the default code. We need to replace this code with our own code for the sample webpage.
Step 47: The default code is replaced with our own code in index.html. Save and exit the editor.
Step 48: We can verify that we are able to access the hosted webpage using âcurlâ inside the instance.
Step 49: The hosted web page can also be accessed from the host OS as shown.
Step 50: The hosted web page can also be accessed by another system (a smartphone â iOS 14.7.1) as shown.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now !
Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!
Last Updated :
28 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Add Your Comment
Please Login to comment...