Configuring Virtual Hosting in Apache

Linux

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

“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: