Hosting Apache Webserver with a simple webpage in AWS instance
To perform the below task you have to do the following :
Create an AWS account.
Launch Amazon Linux from Ec2 Instance and then log in to that instance.
Copy the public IP for further use.
Login to your root account using the command sudo -su root
To provide and access web services we have two steps respectively
Configure/Setup a server
Configure/Setup a client
Steps for configuring a server :
Install the software where you will provide your web services.
here we will use Apache webserver. first, you can check whether you have already installed the software using rpm -q httpd , if not installed you can install it using yum install httpd
Setup the requirement of the server
In my case, I'm just creating a simple webpage. To do so we have the following steps
create your webpage using the following command vim anu.html
enter the content and save, to view the content you can use the cat command, cat anu.html
After saving, copy that to the following folder /var/www/html, the command for copying the file is cp anu.html /var/www/html
- Hosting the webpage /Starting the services
to start the services the following command is used
systemctl start httpd
to check whether it is active or not you can check using the command systemctl status httpd
- After successfully hosting the server, Now you can set up the client
Steps for configuring a client:
Install a web client software
for GUI you can install Firefox or any other software to access the website. the command to install Firefox is
yum install firefox
for CLI you can use the curl command curl http://<ipaddress>/<wbpgname
Connect to the server
To connect to the server, the client should know the IP protocol and the service.
To connect you have to form a URL
<protocol>/<public ip>/<webpagename>
Sometimes while connecting issues related to the firewall can arise.
In such a scenario, you can check your firewall status and stop it using the following command
systemctl status firewalld
systemctl stop firewalld
Thank you!