How To Install the Apache Web Server on CentOS 7

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!!

apache on centos 7apache virtual host on centos 7how to configure web server in linux redhat 6install apache on centos 7setup virtual host on centos 7virtualhost on centos 7
Comments (1)
Add Comment