You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1996/11/25 20:38:11 UTC

Thud

I unleashed my Webmaster on the latest snapshot. He loved "Configure; make",
but was less pleased when adding a virtual host - this caused the main host to
stop serving. Analysis shows the cause to be s->server_hostname being NULL.
This, in turn, was caused by a lack of DNS for the virtual host. A quick fix
is:

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.89
diff -c -r1.89 http_main.c
*** http_main.c 1996/11/22 03:17:07     1.89
--- http_main.c 1996/11/25 20:33:49
***************
*** 1323,1328 ****
--- 1323,1333 ----
                                   sizeof (struct in_addr), AF_INET);
                if (h != NULL)
                    s->server_hostname = pstrdup (pconf, (char *)h->h_name);
+               else
+                   {
+                   fprintf(stderr,"Failed to resolve server name (check DNS)\n");
+                   exit(0);
+                   }
            }
        }
      }

Of course, this doesn't really fix it, but at least it gives you a clue! The
workaround is to add "ServerName a.b.c.d" to the virtual host, where a.b.c.d is
the IP address. It might be helpful to add this to the docco.

Someone with more time than me might care to craft a more helpful error (like,
maybe, mentioning which virtual host).

Cheers,

Ben.

-- 
Ben Laurie                Phone: +44 (181) 994 6435  Email: ben@algroup.co.uk
Freelance Consultant and  Fax:   +44 (181) 994 6472
Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
London, England.          Apache-SSL author