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

I've seen this in the wild before: an Apache server that serves different sites to requests for different domain names, like so:
    ^ domainA.com
    ^ domainB.com
    ^ domainC.com

Each one of these domains should have a separate VirtualHost, as well as a global VirtualHost for all other requests (namely those coming directly to the IP address). How can I make this possible on my server?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
# this is into httpd.conf
NameVirtualHost *

# domain1.com
<VirtualHost *>
ServerName www.domain1.com
DocumentRoot /www/domain1

# domain2.com
<VirtualHost *>
ServerName www.domain2.com
DocumentRoot /www/domain2
share|improve this answer

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.