The term Virtual Host refers to the practice of running more than one web site on a single machine. Virtual hosts can be “IP-based”, meaning that you have a different IP address for every web site, or “Name-based”, meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.
To use name-based Virtual Host come through the next steps:
Click Config button for Apache server in your environment.
Navigate to the /etc/httpd/conf/httpd.conf file.
Before you actually start configuring your virtual host make sure you have the NameVirtualHosts line uncommented:
Then find < VirtualHost > block. You should create < VirtualHost > block for each different host that you would like to serve.Note, that the argument to the < VirtualHost > directive must match a defined NameVirtualHost directive (in our case it is *:80). Inside each < VirtualHost > block, you will need at minimum 2 directives:
If many servers want to be accessible by more than one name, you can use the ServerAlias directive, placed inside the < VirtualHost > section. You can enter there all the names which people can use to see your web site. Entering this names you can also use “*” and “?” wildcards characters.
Finally, you can fine-tune the configuration of the virtual hosts by placing other directives inside the < VirtualHost > containers. Most directives can be placed in these containers and will then change the configuration only of the relevant virtual host.To find out if a particular directive is allowed follow the link. Configuration directives set in the main server context (outside any < VirtualHost > container) will be used only if they are not overridden by the virtual host settings.
Powered by BetterDocs
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.