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

Getting virtual hosts working under OS X Server, El Capitan

I have an old imac with several websites hosted on it. It's running OS 10.6.8 and MAMP hosts the sites. Configuring the virtual servers was a breeze.


Now I'm trying to set up a new server on a different mac running OS 10.11.2 and Server 5.0.15. I have my default site functioning just fine. In the Server admin interface, I then added another site with a separate domain name. I specified both the regular and www versions, placed all files in the correct directory, etc. But when I try and access the server with the second domain name, it doesn't respond.


I thought perhaps it was an external DNS issue, so I edited the hosts file on the server to point the second domain name to 127.0.0.1, but still no dice. Anyone gotten this working? Why is it so easy with MAMP, but so hard with Mac Server?

iMac, OS X El Capitan (10.11.2), Server 5.0.15

Posted on Jan 23, 2016 9:00 PM

Reply
7 replies

Jan 24, 2016 2:54 AM in response to agoraphonics

Normally, with the webserver build into OS X on your Mac, you can only run one website at a time. Besides creating a dummy top level with virtual hosts as one solution, and MAMP there are solutions like VirtualhostX available. The present version 6 builds on the premise of MAMP. His upcoming version 7 seems to hold a lot of aces in hand with far better protection to the underlying OS wrt to upgrades, plus the fact that it is totally virtualised.


Leo

Jan 24, 2016 7:19 AM in response to agoraphonics

Have you tried accessing the second site just by root domain, not with the "www"? I'm a long time OS X Server user. Yes, it supports multiple vhosts. However, I just started moving sites to 10.11 last night and noticed that ServerAlias ("Additional Domains") is not working properly. When I add the root domain for "Domain Name", and then "www" for the "Additional Domains", I'm forwarded to the Wiki when I attempt "www.domain.com". If I create a second website entry specifically for "www.domain.com", it works. That implies my DNS, etc. is working correctly and that something is broken with ServerAlias. It most certainly used to work in previous version of OS X Server.

Jan 24, 2016 10:34 AM in response to JaimeMagiera

agoraphonics wrote:


Thanks for the response, but I'm not running the server built into OS X (personal web sharing) - I'm running OS X Server http://www.apple.com/osx/server/


It can supposedly configure virtual hosts - it's just not working for me.

and

JaimeMagiera wrote:


Have you tried accessing the second site just by root domain, not with the "www"? I'm a long time OS X Server user. Yes, it supports multiple vhosts. However, I just started moving sites to 10.11 last night and noticed that ServerAlias ("Additional Domains") is not working properly. When I add the root domain for "Domain Name", and then "www" for the "Additional Domains", I'm forwarded to the Wiki when I attempt "www.domain.com". If I create a second website entry specifically for "www.domain.com", it works. That implies my DNS, etc. is working correctly and that something is broken with ServerAlias. It most certainly used to work in previous version of OS X Server.

Nothing is broken. Virtual hosts work on OS X El Capitan with Server 5.0.15 (build15S4033). DNS must be configured correctly, taking in account that with Open Directory and Profile Manager running, Apple has really clamped down on the port settings for server. It takes ownership of a list of ports on all available interfaces. If you do need the profile manager, wiki etc running, the lower numbered IP4 interface should be leaved for the default server. The higher numbered should be your virtual hosts (websites) You can create these 'new' interfaces in Network settings. If you are not sure how to, ask for instructions.


It is necessary to edit the virtual host ports which are in:


/Library/Server/Web/Config/Proxy/apache_serviceproxy.conf


and change the lines by substituting the * with the lower IP4 Adress as applicable, leaving the other available for the virtual sites. Repeat for the next port as in this file, ie:

<VirtualHost *:80>

<VirtualHost *:443>

<VirtualHost *:8443>

<VirtualHost *:8843>

<VirtualHost *:8008>

<VirtualHost *:8080>

but take care not to change the structure.

Create the virtual domains (websites) in the Websites window of server. Ensure that besides the Zone, A records, C records, DNS (referring to the primary DNS) are all in place. Restart the Mac and test. If the failure of too many redirects occur on your profile manager, change the SSL port (443) back.

Maybe Strontium can explain why the redirect problem is still there as I have searched, but have not found as yet the reason.

Mine works without a problem, and this has been throught several iterations of upgrades.


Leo

Jan 24, 2016 4:14 PM in response to Leopardus

JaimeMagiera wrote:


Have you tried accessing the second site just by root domain, not with the "www"?


Yes, I've tried accessing both versions of the domain.



Leo, thanks for the detailed instructions. I've got it working with MAMP now, but your suggestion may come in handy in the future. It seems like MAMP is configuring the virtual host ports automatically, which is what I would expect Mac Server to do. If it has a GUI that lets you add virtual hosts, then why make you edit apache config files manually? Oh well- it's working now. Thanks again!

Jan 25, 2016 12:49 AM in response to agoraphonics

agoraphonics wrote:



Have you tried accessing the second site just by root domain, not with the "www"?


Yes, I've tried accessing both versions of the domain.



Leo, thanks for the detailed instructions. I've got it working with MAMP now, but your suggestion may come in handy in the future. It seems like MAMP is configuring the virtual host ports automatically, which is what I would expect Mac Server to do. If it has a GUI that lets you add virtual hosts, then why make you edit apache config files manually? Oh well- it's working now. Thanks again!


Glad you got it sorted and that they are working. Keep them running. Using this method, it is possible to have a multitude of sites running on El Capitan. Of course, with more interfaces and bandwidth available, and the correct server architecture, the sky is the limit. Central to that is the theme of planning the whole site properly beforehand.


Leo

Mar 18, 2016 3:23 PM in response to agoraphonics

With the server application, it is straightforward to get many sites running at once.


You add site in the Websites panel and then point the DNS to them in the DNS panel. The DNS is simple once you have worked it out, but most of the guides on the net are written badly.


Anyway, here are two screenshots that at least show you where to look.

Web server panel: https://yadi.sk/i/ateQpaoXqJjRv


DNS panel: https://yadi.sk/i/zH4CzDasqJjRV


Although it says "local" on the panels, all of these sites are web-accessible.


And you don't need Open Directory turned on for any of this to work.

Getting virtual hosts working under OS X Server, El Capitan

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