Introduction
An HTTP web server is a software application that receives requests and sends responses using the Hypertext Transfer Protocol (HTTP). It is responsible for serving web content such as HTML pages, images, videos, and other resources to clients, typically web browsers like Google Chrome, Firefox, or Safari.
HTTP web servers typically listen on port 80 or 443 for incoming requests, and use the HTTP protocol to communicate with clients. They can serve static content directly from the file system or generate dynamic content by running scripts or applications.
Some popular HTTP web servers include Apache, Nginx, Microsoft IIS, and Caddy. These servers can be configured with various features such as SSL/TLS encryption, load balancing, caching, and more to optimize performance and security for web applications.
Apache Web Server
-
First, we need the domain make sure to buy the domain name either from Godaddy.com or Google Domain Name.
-
Create an
Arecord in theDNSsettings that points to the IP address of your server whereApacheis installed.(I chosedGodaddy.com). -
Get the Public Ip from EC2 Instance by typing
1
curl ifconfig.me
-
Install
Apacheweb server on your server by running the following command1
sudo apt-get update && sudo apt-get install apache2 -y
-
Create a new virtual host configuration file for your domain. You can do this by creating a new file in the
/etc/apache2/sites-available/directory with a name likewww.decodeai.in.conf1
sudo nano /etc/apache2/sites-available/www.decodeai.in.conf -
Inside the file, add the following configuration:
1 2 3 4 5 6 7
<VirtualHost *:80> ServerName www.decodeai.in ServerAlias decodeai.in DocumentRoot /var/www/www.decodeai.in/public_html ErrorLog ${APACHE_LOG_DIR}/www.decodeai.in_error.log CustomLog ${APACHE_LOG_DIR}/www.decodeai.in_access.log combined </VirtualHost>
-
Create the directory for your domain’s files:
1
sudo mkdir -p /var/www/www.decodeai.in/public_html
-
Set the appropriate permissions for the directory:
1 2
sudo chown -R www-data:www-data /var/www/www.decodeai.in/public_html sudo chmod -R 755 /var/www/www.decodeai.in
-
Create an index file in the
public_htmldirectory to test the configuration:1
sudo nano /var/www/www.decodeai.in/public_html/index.htmlAdd some content to the file, such as “
Hello World”. -
Enable the virtual host and restart Apache:
1 2
sudo a2ensite www.decodeai.in.conf sudo systemctl restart apache2
-
Finally, verify that your website is accessible through your domain name by opening a web browser and navigating to
http://www.decodeai.in. You should see the content you added to the index file in the previous step.
That’s it! Your Apache web server is now configured to serve your website using your domain name www.decodeai.in.
Summary
An HTTP web server receives and sends responses using the HTTP protocol, serving web content to clients such as web browsers. It can serve static content directly or generate dynamic content by running scripts or applications. Popular HTTP web servers include Apache, Nginx, Microsoft IIS, and Caddy, with various features for performance and security optimization of web applications.
