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.

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

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

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

share|improve this question
It's not entirely clear what your problem is. When you say doesn't work what error messages do you see in the browser and the error log? –  Iain Nov 5 '12 at 9:37
There are no errors, it simply drops to the default host instead of routing it to the DocumentRoot. –  Ethon Bridges Nov 5 '12 at 9:58
So if you put the ? in, then everything magically starts working? It sounds like you've found some sort of weird bug, and perhaps you should be talking to Apache. –  Michael Hampton Nov 5 '12 at 16:09

1 Answer 1

? is not a wildcard at all, as far as I'm aware - not in ServerAlias, and most definitely not in ServerName, which doesn't support any kind of wildcard.

On a test system, I'm seeing the behavior I'd expect - ServerName test.ws works great, and ServerName test.ws? never maps a request to that vhost.

I expect you're seeing some other issue - the vhost that's getting the request when you've got the invalid .ws? names in there is actually serving the request correctly. Please provide the output from apachectl -S and any relevant virtual host configs from that output.

share|improve this answer
Sorry to disagree.... httpd.apache.org/docs/2.2/vhosts/name-based.html#page-header –  Ethon Bridges Nov 6 '12 at 9:09
Let me do some further testing. I'm going to trim down the vhosts file to one host, then add each host and see where it breaks. –  Ethon Bridges Nov 6 '12 at 9:12
@EthonBridges While you're at it, please provide that apachectl -S output. –  Shane Madden Nov 6 '12 at 16:22

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.