Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the difference between "NameVirtualHost *" and "NameVirtualHost"? Both seem to be implementing name-based virtualhosts, both seem to work. How does "" become a wildcard?

share|improve this question
up vote 3 down vote accepted

I believe they are the same from brief look at the code:

AP_DECLARE(void) ap_init_vhost_config(apr_pool_t *p)
 /* Parses a host of the form <address>[:port]


if (strcmp(host, "*") == 0) {
        rv = apr_sockaddr_info_get(&my_addr, "", APR_INET, port, 0, p);
else {
        rv = apr_sockaddr_info_get(&my_addr, host, APR_UNSPEC, port, 0, p);

So it looks like * just gets parsed to in this instance, and if it actually is it will get passed as such (Although maybe APR_INET vs. APR_UNSPEC matters, but I think that might just be IPv compatibility thing, so maybe there is a difference in that IPv4 when and IPv6 is possible when *, not sure). But I could be interpreting this totally wrong, you can see for yourself in server/vhost.c.

share|improve this answer

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.