Setting multiple Apache2 VirtualHosts with the same DocumentRoot?

Posted on

Setting multiple Apache2 VirtualHosts with the same DocumentRoot? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, , , , .

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

Solution :

No problem with that. But I’d rather used multiple serverAlias.

Leave a Reply

Your email address will not be published.