Setting multiple Apache2 VirtualHosts with the same DocumentRoot?

Posted by sobi3ch on Server Fault See other posts from Server Fault or by sobi3ch
Published on 2012-06-07T10:26:02Z Indexed on 2012/06/07 10:42 UTC
Read the original article Hit count: 403

Filed under:

I'm trying to accomplish something like this

DocumentRoot /www/_offline.com

<VirtualHost *:80>
      ServerName example1.com
      ServerAlias www.example1.com
</VirtualHost>

<VirtualHost *:80>
      ServerName example2.com
      ServerAlias www.example2.com
      DocumentRoot /www/_offline.com
</VirtualHost>

Is it possible to have ONE documentRoot for different domains?

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localhost (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost aa.atd (/etc/apache2/sites-enabled/all-phoenix-domains:2)
         port 80 namevhost atd.atd (/etc/apache2/sites-enabled/all-phoenix-domains:13)
         port 80 namevhost test (/etc/apache2/sites-enabled/test:1)
Syntax OK

© Server Fault or respective owner

Related posts about apache2