Apache virtual server httpd-vhosts undocumented issue

Posted by Ethon Bridges on Server Fault See other posts from Server Fault or by Ethon Bridges
Published on 2012-11-05T09:29:02Z Indexed on 2012/11/05 11:06 UTC
Read the original article Hit count: 303

Filed under:
|
|

I have read the Apache documentation on the https-vhosts.conf file and after a couple of hours fighting this problem, figured it out on my own. Here's the situation:

We have a domain that ends in a .ws

Apparently you can't do this in the conf file. You MUST use the ? wildcard or it will not work. The * wildcard will not work either. Further, in the ServerAlias directive, anything past the first entry will not work if the first entry in the ServerAlias directive is not correct.

Here is an example of an entry that does NOT work. Note that anotherdomain.com and yetanotherdomain.com will fail because thedomain.ws is not configured correctly:

<VirtualHost *:80>
DocumentRoot /opt/local/apache2/sites/ourdomain
ServerName www.thedomain.ws
ServerAlias thedomain.ws another domain.com yetanotherdomain.com
<Directory /opt/local/apache2/sites/ourdomain>
allow from all
</Directory>
</VirtualHost>

Here is an example of our working entry:

<VirtualHost *:80>
DocumentRoot /opt/local/apache2/sites/ourdomain
ServerName www.thedomain.ws?
ServerAlias thedomain.ws? another domain.com yetanotherdomain.com
<Directory /opt/local/apache2/sites/ourdomain>
allow from all
</Directory>
</VirtualHost>

If there is documentation of this, I sure didn't see it.

© Server Fault or respective owner

Related posts about apache2

Related posts about httpd