Configuring Virtual Hosting in Apache

“Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers).”

Wikipedia

How Does Apache Know Which Site to Serve?


The short answer to your specific case: apache will serve the FIRST overlapping virtual host. Since 000-default is before fc.localhost in the alphabet the first virtualhost is loaded and served.

To answer what i assume is the follow up question: You can host many sites on the same IP:PORT using named VirtualHosts

The host field in the http request header identifies which site (virtual
host) to serve:

Matched against the containers in the configuration file

A More Complete Virtual Host Definition

You can put (almost) any directive inside a virtual host container For example, it’s common to write separate logs for each site

Name Resolution

  1. In the “real world” our East and West sites would each have an entry in DNS (Domain Name Service)
  2. Our demonstration system uses only /etc/hosts for name resolution: