February 22, 2024

How To Install the Apache Web Server on CentOS 7

The majority of the worlds’ website is hosted on apache web-server. It is the most powerful server with features like robust media support and extensive integration with other popular software.

In this article, we will explain to you how to install an Apache web server on centos 7 server. So let’s get started 🙂

Step #1 : Installing Apache web-Server

Before installing Apache web server update your local repository, since apache is already available on our repository by default, you just need to run the command as follows:-

What is PHP and How to Use it.

What is Kali Linux and How to use these Software
sudo yum install update
To Install httpd package
sudo yum install httpd
After completing the installation, then you are ready to start the service.

Step #2 : Check your httpd web-Server

In centOS apache do not start automatically, you will need to start the service manually.

sudo systemctl start httpd

Verify the status by running the command:-

sudo systemctl status httpd

You will see the ouput as active status when its running

Access the landing page for in your browser for confirmation

http://your_server_ip

You will see the default httpd landing page like this-

Step #3 Setting up Virtual Host

By default httpd directory is /var /www/html , if you want to host any website then go to that directory and save your projects there in order to host your project on the web

Open the following directory to make a new virtual host entry /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/example.com/html
    ErrorLog /var/www/example.com/log/error.log
    CustomLog /var/www/example.com/log/requests.log combined
</VirtualHost>

Save and close the file when finished

Then just restart or reload the httpd server

For start/stop and reload related check link: https://vexplains.com/start-restart-and-stop-apache-web-server-on-linux/

All done now httpd will serve your domain!!

Vedant Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh