How to Set Up a DNS Alias with Apache – Knowligent
How to Set Up a DNS Alias with Apache

How to Set Up a DNS Alias with Apache

HomeHow to, TechHow to Set Up a DNS Alias with Apache

Set up DNS aliases with the Apache web server to point different hostnames to different directories on your web server.

What are CNAME records? (and how they relate to DNS A records)

You can create one or more directories for content within your web server file structure, but you can't place them anywhere on your machine. For example, most of the Apache server's web files are in the htdocs directory. Create a subdirectory there to host your domain files, perhaps in a www directory to separate the content from other applications. It's a good idea to place an index.html file in the directory so you can test it later.

In both versions you need to edit the vhosts section to add a new virtual host.

A typical use case involves running multiple hostnames that point to the same Internet Protocol address, and each hostname must respond differently. For example, internal.server.com might point to a company's intranet site, while www.server.com might point to the public web page. To configure these examples, edit the virtual-host file as follows: