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.
<VirtualHost mydomain1.com:80>
    ServerAdmin webmaster@localhost
   ...stuff here


<VirtualHost mydomain2.com:80>
    ServerAdmin webmaster@localhost
    ...stuff here

This doesn't seem to work.

Before, it was <VirtualHost *:80> and it worked.

share|improve this question

migrated from stackoverflow.com Oct 20 '10 at 8:10

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

2 Answers 2

it should have

NameVirtualHost domains.local:80

this is a full working example

NameVirtualHost domains.local:80
<VirtualHost domains.local:80>
   DocumentRoot "C:/****/public"
   ServerName domains.local
   # This should be omitted in the production environment
   SetEnv APPLICATION_ENV development
   <Directory "C:/*****/public">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
share|improve this answer

Use <VirtualHost *:80> for each of your vhost directives. Then specify the ServerName for each vhost directive.

If you do that then you don't need to set up NameVirtualHost for each vhost, although that will work too. I'd be interested to see if anyone has any info on why one method is better than the other.

You can also use ServerAlias if you want to give an alternative hostname for the same vhost.

See http://httpd.apache.org/docs/2.2/vhosts/ for more.

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.