Setting up virtual hosts
It's very common for a single organization to host multiple sites. Each of these sites can live on their own server or virtual machine, but that's not very practical. Running just one site per server is very expensive and not very efficient. The concept of virtual hosts is that multiple sites can live on one web server, which saves infrastructure. Of course, it's always possible that you may have a website that generates so much traffic that sharing it with other high-traffic sites may not be a good idea, but when this is not the case, virtual hosts are recommended.
As mentioned before, /var/www
is the default location where Apache looks for files to serve. If you're hosting multiple sites on one server, you would want to create a separate directory for each of them. For example, if you are hosting a website for a company named tryadtech.com
and another for linuxpros.com
, you could create the following directory structure:
/var/www/tryadtech.com/html /var/www/linuxpros...