How to Setup HTTPD Web Server with custom configuration

Nivas DevSecOps
2 min readAug 16, 2024

--

In this article, we will see how to change the default port no, document root, and log the location of the apache webserver.

TASK DESCRIPTION:-

  • Install the HTTPD server in Amazon Linux or Ubuntu
  • Change the default context to your context from this path: "/var/www/html/index.html.”
echo "<h1>Hello Guys, welcome to devops</h1>" > /var/www/html/index.html

Now Let’s start the task-

STEP -1: — Install webserver (httpd)

yum install httpd -y

webserver installed successfully

echo "<h1>Hello Nivas, welcome to devops</h1>" > /var/www/html/index.html

If you start the httpd service and try to access web pages then you will see the default setting

Copy paste the EC2 instance Public Ip in the browser. You will get like this..!

Overall Script:

Type 1:

Use the below script after the instance launch and implement in server.

yum install httpd -y
echo "<h1>Hello Team..! welcome to devops</h1>" > /var/www/html/index.html
systemctl start httpd
systemctl status httpd

Type 2:

Use this below script in the USER DATA place.

#!/bin/bash
yum install httpd -y
service httpd start
chkconfig httpd on
mkdir /var/www/html/app
echo "<h1> Hi Guys, welcome to DevOps world </h1>" > /var/www/html/app/index.html
echo "configured successfully"

--

--

Nivas DevSecOps
Nivas DevSecOps

Written by Nivas DevSecOps

Cloud | DevSecOps| AWS ⭐Passionate Cloud and DevOps . 🎯 Like to stay up-to-date with the latest trends and insights.

No responses yet