Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My client site is: xyz.com.br

I have created a demo.xyz.com.br (DNS Record A) pointing to the ip address of my server.

The request is reaching my server.

The problem:

How do I setup Virtual Host on appache to hit the root directory of the 2nd level domain, if the domain is not hosted on my server?

share|improve this question

migrated from stackoverflow.com Mar 29 '11 at 13:07

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

add comment

1 Answer

Same way you would a regular domain. Servername demo.xyz.com.br and set the documentroot to the path of the web files. As long as DNS is correct, you'll be fine.

<VirtualHost *:80>
    ServerName demo.xyz.com.br
    DocumentRoot /var/www/html/myfiles
share|improve this answer
That does not answer @CrazyJoe's question. –  Guy Mar 29 '11 at 12:46
Maybe I misunderstood, he wants what now? He wants the subdomain to hit the files on the domain itself without hosting the file? There's no way, that's like me saying let's host facebook.com on my domain. I'm thinking maybe some type of proxy but I wouldn't bet on it. –  luckytaxi Mar 29 '11 at 12:50
No, I think this answers the question just fine. –  Kieren Johnstone Mar 29 '11 at 12:52
Ok, but does not work!! The Problem: You don't have permission to access / on this server. The xyz.com.br is hosted on another server , its possible? Thank's –  CrazyJoe Mar 29 '11 at 13:00
Forget about the TLD. If DNS points to your server for a subdomain, requests coming in will be for that ServerName. The problem you are experiencing is nothing to do with the fact the root domain is on another server - it's a permissions issue. (You should create a new question if you're unable to solve it) –  Kieren Johnstone Mar 29 '11 at 13:06
add comment

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.