apachevirtualhostosx-elcapitanosx-server

El capitan OS X Server 5.1 upgrade breaks virtualhosts


It's been 2 years I am running OS X server, had more or less troubles with it. Yesterday, I updated to server 5.1 and web server completely broke. All settings looks there in Web section panel of server app.

enter image description here

However when looking for the site, Safari could not find it. I dig several hours on this issue and find out that virtual_host_global.conf contains only this :

# This file is auto-generated by the Server application's
# configuration mechanism whenever settings are saved.
# The Listen directives are generated
# based on the VirtualHost directive inside
# each site configuration file found in this directory.

Listen  127.0.0.1:34543
Listen  127.0.0.1:34580

After updating it manually to this

# This file is auto-generated by the web configuration
# mechanism whenever settings are saved.
# The Listen and NameVirtualHost directives are generated
# based on the VirtualHost directive inside
# each site configuration file found in this directory.
#
Listen  *:443
Listen  *:80

And restarting server everything went back to normal. However if I change settings from server app the app rewrite this file and breaks everything.

I don't understand why it breaks from a simple update. Does anyone knows how to make my modification permanent? Which configuration file or items in Server app do I need to change to have it working everytime I change something from server UI?

Thanks


Solution

  • I finally fixed my problem!

    First and foremost I found documentation here

    /Library/Server/Web/Config/apache2/ReadMe.txt

    In this document, I found a command to reset server service to factory settings (BE CAREFUL TO SAVE YOUR DATA BEFORE, /Library/Server/Web/ folder)

    sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin command web:command=restoreFactorySettings

    After this reset, website service just worked nicely. I don't really know what went wrong during server update. But I suspect something as I notice a new redirect parameter on my default site that wasn't present before the factory setting reset

    Default site has now 1 redirect

    Here is detail of redirect panel :

    Detail of redirect

    Therefor, if you have such a big issue regarding Web service part of new OS X server app. Don't hesitate to reset it to factory setting as upgrade can break it.