Configure Web Server on AWS Cloud

Niket Ranjan
Analytics Vidhya
Published in
4 min readJan 25, 2022

--

In this blog, I am going to configure the apache & Nginx web server on the AWS instance. There is no pre-requisite for this practical.

What is Cloud Computing?

Cloud computing is the on-demand delivery of IT resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining physical data centers and servers, you can access technology services, such as computing power, storage, and databases, on an as-needed basis from a cloud provider like Amazon Web Services (AWS).

What is a Web Server?

A web server is a computer where the web content is stored. Basically, the webserver is used to host the websites but there exist other web servers also such as gaming, storage, FTP, email, etc.

What is the Client-Server model?

The client-server model is the relationship between two computers in which one, the client, makes a service request from another, the server

This is all about a brief overview of Cloud Computing, Web Server & Client-Server Model.

Now, we are going to Configure the web server over the AWS instance.

Web Server is a just concept name, we have different tools available in the market but we are using two famous tools to configure the webserver.

  • Apache: HTTPD
  • NGINX

If we want to configure any server in the world mainly follows three steps:

Step 1: Install Software

Step 2: Configure Files

Step 3: Execute/ Start Services

The files where we configure i.e, Configuration Files.

If you use a web server to put your web pages and ask webserver to provide those web pages to clients i.e, Web Hosting.

Now, we are Going to Configure the Web server on AWS Instance(ec2) Using Apache: HTTPD

Step 1 : #rpm -q httpd (Check software is installed or not)

Step 2 : #dnf/yum install httpd (Install the software on instance)

We have installed the software on ec2 instance move to another step.

Step 3 : #cd /var/www/html ( Document Root )

Step 4: #gedit index.html ( Put the content here)

This is by default folder they created. When the client comes to the web server they retrieve pages from this folder.

Now, Our last step is to Start the services.

Step 5: #systemctl start httpd ( Start the services)

Step 6: #systemctl status httpd (Check services is started or not)

When a client wants to access the web pages they need an IP address and also when the client requests the web server, then three things they need.

When anyone from the outside world (Client) wants to connect means hit to the web server through network packets in the web server they have once security guard they have their own rules they allow or not i.e, Firewall.

Now, we can write our own rules for the firewall or we can disable the firewall for some time (only for testing purposes).

CMD: #systemctl stop firewalld (Stop the internal firewall of OS)

Now Finally, we have configured our web server. The client will hit that web server.

The client have two ways to connect with the webserver :

  • CLI Mode (Command Line Browser)
  • GUI ( Web Browser: Chrome, Firefox)
  1. For CLI mode they need to use #curl cmd there will not execute they only read the HTML pages:

#curl HTTP://{Public_ip}//index.html

2. For GUI mode they put URL to the Web browser.

For this Practical you can also watch Video for better understanding :

Finally, we have Configured Web Server By Apache: HTTPD.

Now, we are Going to Configure the Web server on AWS Instance(ec2) Using Nginx.

Same Process like Apace Web Server:

Step 1: #yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ( Create yum repo of epel release)

Step 2:#yum install -y epel-release ( Install Epel Release)

Step 3: #yum update -y ( It will update yum of instance)

Step 4: #yum install nginx -y (Install Nginx Software)

Step 5: #nginx -v (Check Version of Nginx)

Till now, we have installed Software on the ec2 instance.

Step 6: #gedit /usr/share/nginx/html/index.html ( Document Root )

This is by default folder they created. When the client comes to the web server they retrieve pages from this folder.

Now, Our last step is to Start the services.

Step 7: #systemctl start nginx ( Start the services)

Step 8: #systemctl enable/disable nginx (Enable/ Disable services)

Step 9: #systemctl status nginx (Check services is started or not)

Now, the Client will come and access the web page through Public IP.

For this Practical you can also watch Video for better understanding:

Finally, we have configured the Web server on AWS ec2 instance by using NGINX & Apache HTTPD.

Thank You..!!

--

--

Niket Ranjan
Analytics Vidhya

I’m passionate learner diving into the concepts of computing 💻. I am a Software engineer from India skilled in Linux, DevOps, and Cloud Computing.