apache tutorial - What is Virtual host in Apache - apache - apache web server - apache server - apache2
Virtual host in apache
- An Apache web server can host multiple websites on the SAME server. You do not need separate server machine and apache software for each website. This can achieved using the concept of Virtual Host or VHost.
- Any domain that you want to host on your web server will have a separate entry in apache configuration file.
Types of Apache Virtualhost
- Name-based Virtual host
- Address-based or IP based virtual host and.
Name-based Virtual Host
- Name based virtual hosting is used to host multiple virtual sites on a single IP address.
- n order to configure name based virtual hosting, you have to set the IP address on which you are going to receive the Apache requests for all the desired websites. You can do this by NameVirutalHost directive within the apache configuration i.e. httpd.conf/apache2.conf file.
Apache virtual host Example:
- You can add as many virtual hosts, as per your requirement. You can check your web configuration files with:
- f the configuration file has some wrong syntax, it will throw an error