Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Virtual Hosts Issues

I have a fresh install of Mac OS X 10.4 Server, and am having some problems setting up virtual hosts. I have 2 sites I'd like to host. Both are configured under the Sites tab of Web services. Both are pointing to different web folders. Both are using the same IP (the only IP this server has), and both are using port 80.

Regardless of which site I try to access, I always get the first sites default page. I've already checked to make sure it's not a caching issue, and I have turned on the vhost aliasmodule.

I've read through some old posts on this subject, but haven't found a solution that works yet. Any one know how to resolve this? Thanks!

Mac OS X (10.4.8)

Posted on Dec 21, 2006 7:30 PM

Reply
21 replies

Dec 22, 2006 1:04 AM in response to Tom Ropers

If you have multiple sites configured on the same IP address and port, then the hostname in the http request has to match the name of the site.

This means that if you've setup your second site as 'someother.com', then that's the URL you have to request: http://someother.com/
If you use any other hostname (e.g. http://www.someother.com/ ) it won't work since the name doesn't match.

If the name doesn't match then the default site will be used.

Dec 23, 2006 4:08 PM in response to Tom Ropers

Somewhere in that dopey GUI, there's a (I think) checkbox that's supposed to be the default allowing for name based virtual hosting. Perhaps it got unchecked/selected?

The money line in httpd.conf is NameVirtualHost for name based virtual hosting.

Just for fun, you may want to run:

sudo apachectl configtest

and check /var/log/httpd/error_log

Those should point you to the problem.

Roger

Dec 24, 2006 12:41 AM in response to Community User

I did make sure to enable the virtual host module. I think that's what you're talking about with a checkbox in the GUI, anyway.

I ran that test, and the results didn't show any errors- just a number of warnings that look like:

[Thu Dec 21 21:27:21 2006] [warn] long lost child come home! (pid 552)

They all had different timestamps and different pid's. From the timestamps, it would appear that these are all from when I was testing the config trying to get it to work a few days ago.

Dec 24, 2006 3:43 PM in response to Tom Ropers

The virtual_host module just introduces the concept of virtual hosts to the core Apache server. It doesn't do anything towards selecting name based or IP based virtual hosting.

TBH, I know that name based virtual hosting is the default setup in Apple's implementation. The times that I've tried to use the stupid GUI, all it's done is anger me so I just edit the files by hand. I'm not really familiar with the GUI.

Roger

Jan 11, 2007 3:24 AM in response to Tom Ropers

Are you comfortable with pico? Using the Terminal.app, open the file /etc/httpd/sites/virtualhostglobal.conf.

You should see a line similar to:
Name Virtualhost 123.123.123.123:80

with your IP address.

Make sure that this line is not commented out with the "#" sign.

If you do not have this file, don't worry, it's not hard to recreate.


Extended Keyboard Server Mac OS X (10.4.7)

Jan 14, 2007 8:59 AM in response to Tom Ropers

Ha!
I finally figured it out.

In httpd.conf, at the end of the file there's a section stating to use all of the .conf files in the /etc/httpd/sites directory. Seemingly, Mac OS X Server sets up every site as a virtual host, and creates a .conf file for each site in this directory. The issue ended up being that the directive in http.conf was:

Include "/etc/httpd/sites/*.conf"

I removed the quotes and both of my virtual hosts are working now.

I don't know if this is a bug, or if there's supposed to be some other way to make this work.

Thanks for the help from all of you!

Mar 6, 2007 4:15 PM in response to Community User

Hey, I'm having the same problem that was noted above, but when i do the apachectl configtest i get this output(1.1.1.1 was used to hide my ip):

[Tue Mar 6 19:13:16 2007] [warn] default VirtualHost overlap on port 16080, the first has precedence
[Tue Mar 6 19:13:16 2007] [warn] default VirtualHost overlap on port 16080, the first has precedence
[Tue Mar 6 19:13:16 2007] [warn] NameVirtualHost 1.1.1.1:16080 has no VirtualHosts


Mac Pro Mac OS X (10.4.8)

Virtual Hosts Issues

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.