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

</VirtualHost>

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

This doesn't seem to work.

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

0

2 Answers 2

1

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
   </Directory>
</VirtualHost>
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .