Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Now apache is listening on hostA,how to make it also listen on hostB too?

I've already pointed hostA and hostB to

share|improve this question
up vote 2 down vote accepted

In advance

If you point hostA and hostB to you will only be able to connect to the server from localhost. (Just wanted to put a finger on it, from now on I assume this is your intention)

Now to your question

If you would like to use two different adresses pointing to one directory you will look for something like

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName hostA
    ServerAlias hostB www.hostA www.hostB
    DocumentRoot /www/domain

Otherwise if you would like to use different document roots (also known as name based virtual hosting) you will need to use something like this:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName hostA
    ServerAlias www.hostA
    DocumentRoot /www/hostA

<VirtualHost *:80>
    ServerName hostB
    ServerAlias www.hostB
    DocumentRoot /www/hostB
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.