If you want to access HostC
as a hostname (e.g. hostc.local
) from anything other than a computer with a modified hosts file, you will have to set up a DNS server to map this name to your web server's IP address.
If HostC can be the IP address of the server, then you can just use that.
Assuming either case, you can put sub-folders (ProjectA
and ProjectB
) in HostC (your web server) to access http://HostC/ProjectA/fileA.php
and http://HostC/ProjectB/index.php
. You do not need virtual hosts for this.
If you want http://HostA/ProjectA/fileA.php
and http://HostB/ProjectB/index.php
, then you will need to define HostA and HostB in DNS (to access them from any computer without a modified hosts file, assuming you do not wish to access them via IP address/port combinations). You will need use virtual host entries assuming HostA and HostB both map to the web server on HostC
. You will only need to map HostC in this case if you want to access HostC
as a local domain name, not an IP address.
You may want virtual hosts as well to access services via reverse proxyies to map, say, something like http://HostD:80/directoryD/
to HostD:8080/directoryF/
or ex. 123.123.123.123
.