Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a domain I would like it to map to so I created a cname on the interface of my register. However, when I try to reach, it shows a 404 pointing to the IP of

So my question is, what do I need to configure on my server (that hosts the web page of to recognize

thanks in advance.

share|improve this question
What if I have tons of cname, can I put them in a another file and include it in the config file of my web server? I use nginx but an answer about apache would be good too. – peakty Nov 17 '09 at 5:16

It depends on what http daemon you are using.

If you are using Apache HTTPD with virtualhost entries, you most likely need to add a ServerAlias directive to the VirtualHost entry for your site.

<VirtualHost *:80>
    DocumentRoot /home/
    ... snip ... 
share|improve this answer

What you want to do goes under the term Name Based Virtual Hosting

Technically what is going on is that the web browser resolves to an IP address (e.g. Then it sends an HTTP request to The host does not normally know about the name which was used to address it.

An special feature of HTTP 1.1 however allows the browser to insert the host name into the HTTP header. A typical HTTP header looks like this:

GET / HTTP/1.1

The web server then decides according to the contents of the Host: header which pages to deliver. Of course you have to tell it how to decide in it's configuration. For Apache see here, but any modern web server will have something similar.

Name Based Virtual Hosting is widely used, everytime you hear the term Shared Hosting, think of Name Based Virtual Hosting. HTTP 1.1 is around long enough so that all browsers in use support it. Only very, very old browsers, like NCSA Mosaic, didn't support it.

share|improve this answer

If you're using IIS then you'll need to add host headers to the web site for

share|improve this answer

For nginx, if you want to have a directive handle more than one domain/subdomain, you can put them all in the server_name directive. For example,

server {
    listen 80;
    server_name *;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.