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.

This question already has an answer here:

I want to forward different domain names to single IP Address (local for testing), but how can i recognize in pc that which domain name should be linked to which folder?

for example, in windows host file, I wrote

127.0.0.1       abc.com
127.0.0.1       test.abc.com
127.0.0.1       test1.abc.com
share|improve this question

marked as duplicate by Bryan, mdpc, Dave M, Tim Brigham, Rex Jun 7 '13 at 18:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

Being found within the same VirtualHost section binds the ServerName and DocumentRoot directives together.

<VirtualHost *:80>
  ServerName www1.example.com
  DocumentRoot /srv/web/www1
</VirtuaHost>

<VirtualHost *:80>
  ServerName www2.example.com
  DocumentRoot /srv/web/www2
</VirtuaHost>
share|improve this answer

go to the root configuration directory and run this command

grep -Ri www.domain.tld . (your domain name) or

grep -ri "VirtualHost" / (your specific virtualhost to find its directiory)

and it will lead you to the folder...

share|improve this answer

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