How to configure Apache Server (http) with Virtual Hosting in CentOS 7, Redhat 7, Fedora - Linux tech Solutions
How to configure Apache Server (http) with Virtual Hosting in CentOS 7, Redhat 7, Fedora
Http/Apache is used to host a single website or multiple website on system with static IP address.The Apache HTTP Server, is free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers). This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same host name. The term virtual hosting is usually used in reference to web servers but the principles do carry over to other internet services.
One widely used application is shared web hosting. Shared web hosting prices are lower than a dedicated web server because many customers can be hosted on a single server. It is also very common for a single entity to want to use multiple names on the same machine so that the names can reflect services offered rather than where those services happen to be hosted.
http - 80
Selinux context httpd_sys_content_t
Main Configuration filfe /etc/httpd/conf/httpd.conf
Document root /var/www/html
Server Configuration :-
To configure Apache server we must have an static ip.
1 )first of all we will install the httpd package :-
2 )Now we will create our own configuration file in /etc/httpd/conf.d
You can create with the configuration file with any name but the file extension must be .conf .
In this configuration file you have to give the following parameters:-
3 ) Now we will create a directory for our second website.
4 )Now you need to go the /etc/hosts file.
#[your IP] [your Website name]
5 )Now we will go to the document root and create a index.html file.
My First Web Site
Same we will do for the second website.
My Second Web Site
5 )Now we will start the httpd service.
6 )Now Apply the Firewall rule.
[[email protected] ~]# firewall-cmd --reload
7 )Now our websites are ready we will open it in firefox browser
The Video below is a step by step guide.