Apple Event: May 7th at 7 am PT

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

Multiple websites

It seems pretty clear in the Server app how to configure hosting multiple websites but it doesn't seem to work. No matter what I put in, requests just go to the default Mac OS X Server site. Anyone had luck with this?

Mac mini, Mac OS X (10.6.7), OS X Server

Posted on Jul 20, 2011 12:42 PM

Reply
66 replies

Jul 21, 2011 2:30 PM in response to SGlazier

Guys, it's alot easier than this.


THIS EDIT BELONGS IN YOUR httpd.conf FILE NOT AN INDIVDUAL WEBSITE .conf FILE


/etc/apache2/httpd.conf


Any where in the MAIN server configuration area (and for you techies out there) prefereably in the websharing portion find the area that resembles:


<IF DEFINE MACOSXSERVER>

blah blah

</IF DEFINE>

section,


just add this line on a new line in between the <IF DEFINE> </IF DEFINE> brackets:


NameVirtualHost *:80 (for non-SSL) (<--- don't add the parens)

NameVirtualHost *:443 (for SSL) (<--- don't add the parens)


That's it.


Then all of your virtual hosts should work. There is no need to add the *** MoreTestingRequired line.

Jul 21, 2011 3:13 PM in response to sbkeith

@sbkeith - the reason for breaking it out into a seperate file is to ensure that it doesn't get overwritten by the config tools, or whenever Apple releases a patch that blows away the 300+ line httpd.conf file.


The individual site configuration files are picked up by an include statement at the bottom of the httpd.conf file, so as long as the file placed in the sites directory begins with a string of five zeros then it will be read before the individual VirtualHost statements that relate to each virtual host.

Jul 21, 2011 3:29 PM in response to Seemingly Absent

Yes, I agree with you.


Wasn't bashing your response and if it appeared that way, I humbly apologize.


I always add this edit to the default.conf files to avoid such overwriting and thus far, have been successful.


SysAdmin preference I concede.


Also - a housekeeping note: Delete all the (IF DEFINE !MAC OSXSERVER> entries and comments (they are in the default .conf file anyway) and it won't be 300+ lines. A OS X Server will never be anything other than an OS X Server so these lines are pointless.

Jul 23, 2011 8:19 PM in response to SGlazier

Alright, I've tried the suggestions here along with a lot of other things but I'm not getting this to work. Am I alone, or are there others for whom this doesn't work?


No matter what subdomain I go to (which have different document roots), I always get the "Welcome to Mac OSX Lion" page. Even a virtual-host that's set as a reverse proxy just continues to go to the welcome screen.


I've tried adding as a sites/ file named as suggested, also placing it in the httpd.conf.


Even adding new websites via Server.app doesn't appear to do anything.


This was an upgrade from an existing SLS installation.

Jul 23, 2011 10:02 PM in response to matuzalem

No, I've gone so far now as to disable all of the sites/ .conf files and try hard-coding the virtual host descriptions into the httpd.conf file and still no dice.


One interesting thing: With everything removed the log errors show it is looking for files in /var/empty, as you would expect. If I add in a very short, simple virtualhost for *:80 then I can specify a new DocumentRoot and it works as expected. But, if I add another virtualhost for my real hostname with a different document root, it continues to use the settings (and document root) of the *:80 vhost. If I remove the *:80 virtualhost it falls back to /var/empty.


That indicates to me that the virtualhost directives are being read, but somehow the hostname is being mangled such that the only vhost directive that will match it is *. Does anyone know how to print out the hostname that apache thinks it is operating under?

Multiple websites

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