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