As described in RFC 1034 and detailed in RFC 1035 back in 1987, a CNAME, or Canonical Name, DNS resource record is an alias for a host. By example, let’s take a look at a fictitious host (sigma) in a fictitious domain (example.com) with the following A (address) record:
sigma.example.com IN A 192.168.1.100
This would make sigma.example.com resolve to an IP address of 192.168.1.100. We could use a CNAME record to make an alias for sigma.example.com:
www.example.com IN CNAME sigma.example.com
A DNS query for sigma.example.com or www.example.com would return both the CNAME and Address resource records. All modern web browsers would then use the Address resource record to connect to the site. This enables a single physical host machine or server to mimic multiple individual servers, without the typical user knowing that the web server that their browser connects to is a shared resource.
Using our fictitious host, sigma.example.com, and our fictitious CNAME or alias, www.example.com, we could include the following in our Apache 2.x configuration:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /server/www
ServerName www.example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /server/sigma
ServerName sigma.example.com
</VirtualHost>
Our configuration would allow the single real host, sigma.example.com, to serve web pages for both sigma.example.com and www.example.com.