Apache foolery.

2 posts / 0 new
Last post
#1 Sun, 11/18/2007 - 16:06
flymale

Apache foolery.

Hi,

I have two IPs, and one IP dedicated to a domain that uses SSL certs. The black line points to the dedicated IP, and secure port. The red line points to the regular IP (shared by other domains or virtual serversas well), and regular 80 port.

Both of them go to the same domain's public_html

Now, when I go directly to these IPs, it says "Bad Request HTTP 400".. whereas, I was thinking, since the second virtual server that says "Any" address, on port 80, whatever servername should go to /var/www/html

Yet, it doesn't go there, AND it gives a 400. What do I need to do, when I use one of these two IPs, secure or unsecure to be routed to /var/www/html? [img=http://img132.imageshack.us/img132/3280/ss1pa2.jpg][/img]

Mon, 11/19/2007 - 15:18
Joe
Joe's picture

Apache is tricky. When it is in named virtual hosting mode, it tries to figure out what to do with requests based on two things: the NameVirtualHost directive(s) and the VirtualHost sections. The one that best matches your request is the one that gets served. But, "Any" doesn't have the meaning you think it does in this context (because you've locked up one of the addresses explicitly, Apache can no longer offer "Any" address access). It's probably got something to do with the way libc creates listen sockets in UNIX, but we don't really care about the why.

What you really want to do is create a VirtualHost that listens explicitly on your "shared" address, and make it come first in the list of VirtualHosts (depending on OS this can be tricky--if you're on Debian/Ubuntu, you'll need to rename the host configuration file to 000domain.conf or similar to force it to be loaded first). If your hosts appear in httpd.conf, you can just move it to the top of the list of VirtualHost definitions.

In short, "Default" and "Any" have no useful meaning in a virtual hosting Apache configuration.

--

Check out the forum guidelines!

Topic locked