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 my own vps, and I want to add a subdomain to my domain. I figured this is something that apache can handle.

So I'm using someone else's DNS, which points requests of my domain to my server.

I haven't really done anything to mess with the 'stock' install of apache2.

I currently have this in my sites-enabled:

NameVirtualHost x.x.x.x:80

<VirtualHost x.x.x.x:80>
  DocumentRoot /var/www/domain
  AccessFileName .htaccess
  <Directory /var/www/domain>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all

I tried adding a second virtualhost with the same IP, and just changing any occurrence of to, but I get an error upon restart saying that I have multiple virtualhosts with the same name or something.

I think there is a simple solution to this, and I have spent enough time trying to figure this out.

share|improve this question

migrated from Oct 20 '12 at 23:48

This question came from our site for professional and enthusiast programmers.

Don't forget to add the DNS entry for the sub-domain. – John Gardeniers Oct 21 '12 at 0:07

Must be a simple thing that went wrong. Try this very simple example:

    NameVirtualHost *:80

    <VirtualHost *:80>
    DocumentRoot /var/www/domain

    <VirtualHost *:80>
    DocumentRoot /var/www/sub1

share|improve this answer

Your Answer


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