MacOS – Lion Server: If I create two websites with the same domain name but different ports, web service won’t start

apachemacosserver.app

So, I upgraded my business server to Lion yesterday – BIG mistake. However I really want the WDE that comes with FileVault 2, so I'm trying to cope with all the fuzz. One thing that I can't figure out, however, is why the web service can't start when I add a domain name twice, but with different ports.

Here's what I do:
1. example.com is added with an SSL certficiate (port 443). All is good, site can be accessed.
2. example.com is added without SSL (port 80). Web service dies, can't start, and all my sites die instantly.

Any ideas?


OK, so I figured out the problem at least; whenever an SSL domain is added, Server.app also saves a redirect for the port 80 equivalent of the SSL domain, named 0000_any_80_example.com_shadow.conf. It must be the _shadow.conf that's crashing with the regular port 80 domain .conf.

When I realized this, I stopped the Web service, removed the shadow file, wrote a new "regular" .conf file which I then renamed to _shadow.conf, and turned on Web service… Only to see it be overwritten by the service. ๐Ÿ™


Oh, well – problem solved with an easy workaround. I just saved the port 80 domain differently, so I did this:

Port 443: example.com, additional domains: *.example.com
Port 80: www.example.com, additional domains: *.example.com, example.com

Worked great, luckily. ๐Ÿ™‚

I still would like a "real" solution, though. Any ideas?

Best Answer

The creation of __shadow.conf files might not be stopped in Lion Server.

Apache can be stopped from loading these __shadow.conf configuration files by modifying /etc/apache2/httpd.conf.

There is a section at the bottom that looks like:

<IfDefine WEBSERVICE_ON>
    Include /etc/apache2/sites/*.conf
</IfDefine>

You could change that to for eample (expand the list to match all tld's that your are hosting):

<IfDefine WEBSERVICE_ON>
    Include /etc/apache2/sites/virtual_host_global.conf
    Include /etc/apache2/sites/*_.conf
    Include /etc/apache2/sites/*.nl.conf
    Include /etc/apache2/sites/*.com.conf
</IfDefine>