Skip to content

Instantly share code, notes, and snippets.

@fiedl
Last active September 10, 2017 20:18
Show Gist options
  • Save fiedl/f973f8cc9ac41cce6b04886dfccfdd3d to your computer and use it in GitHub Desktop.
Save fiedl/f973f8cc9ac41cce6b04886dfccfdd3d to your computer and use it in GitHub Desktop.
macOS Server not accessible

macOS Server not accessible

Issue

  • No port of the server application can be reached.

Diagnose

  • The server system log keeps repeating:

    com.apple.xpc.launchd[1] (com.apple.serviceproxy[10725]): Service exited with abnormal code: 1
    com.apple.xpc.launchd[1] (com.apple.serviceproxy): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
    
  • serviceproxy is the proxy apache service. Having a look at the logs at /var/log/apache2: Nothing conclusive.

  • Trying to start the service manually with the same command that can be seen in the apache logs:

    sudo /usr/sbin/httpd -D FOREGROUND -f /Library/Server/Web/Config/apache2/httpd_server_app.conf
    
    [Sun Sep 10 20:06:31.694672 2017] [core:warn] [pid 10580] AH00111: Config variable ${SERVER_INSTALL_PATH_PREFIX} is not defined
    httpd: Syntax error on line 188 of /Library/Server/Web/Config/apache2/httpd_server_app.conf: Cannot load ${SERVER_INSTALL_PATH_PREFIX}/usr/libexec/apache2/mod_bonjour.so into server: dlopen(/usr/${SERVER_INSTALL_PATH_PREFIX}/usr/libexec/apache2/mod_bonjour.so, 10): image not found
    

 But I guess, this is just because SERVER_INSTALL_PATH_PREFIX is not set within the shell. It should be set through the server environment.

  • Which is the proper launch daemon? I think:

     launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
     launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    
  • I just realise, the proper log is /var/log/apache2/service_proxy_error.log:

    [Sat Sep 02 19:48:36.369309 2017] [ssl:debug] [pid 1306] ssl_engine_kernel.c(359): [client fe80::1058:3955:789d:4162:52994] AH02034: Initial (No.1) HTTPS request received for child 0 (server fiedl-mbp.local:443)
    [Sat Sep 02 19:48:36.407747 2017] [ssl:debug] [pid 1306] ssl_engine_kernel.c(359): [client fe80::1058:3955:789d:4162:52994] AH02034: Subsequent (No.2) HTTPS request received for child 0 (server fiedl-mbp.local:443)
    [Sat Sep 02 19:48:36.424741 2017] [ssl:debug] [pid 1306] ssl_engine_kernel.c(359): [client fe80::1058:3955:789d:4162:52994] AH02034: Subsequent (No.3) HTTPS request received for child 0 (server fiedl-mbp.local:443)
    [Sat Sep 02 19:48:36.443559 2017] [ssl:debug] [pid 1306] ssl_engine_kernel.c(359): [client fe80::1058:3955:789d:4162:52994] AH02034: Subsequent (No.4) HTTPS request received for child 0 (server fiedl-mbp.local:443)
    [Sat Sep 02 19:48:36.508489 2017] [ssl:debug] [pid 1306] ssl_engine_kernel.c(359): [client fe80::1058:3955:789d:4162:52994] AH02034: Subsequent (No.5) HTTPS request received for child 0 (server fiedl-mbp.local:443)
    [Sat Sep 02 19:48:37.106364 2017] [proxy:error] [pid 1308] (61)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:34580 (127.0.0.1) failed
    [Sat Sep 02 19:48:37.106489 2017] [proxy_http:error] [pid 1308] [client ::1:52995] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
    [Sat Sep 02 19:48:41.605055 2017] [ssl:debug] [pid 1306] ssl_engine_io.c(1039): [client fe80::1058:3955:789d:4162:52994] AH02001: Connection closed to child 0 with standard shutdown (server fiedl-mbp.local:443)
    [Sat Sep 02 19:49:05.327312 2017] [core:info] [pid 1288] AH00096: removed PID file /var/run/service_proxy.pid (pid=1288)
    [Sat Sep 02 19:49:05.333615 2017] [mpm_prefork:notice] [pid 1288] AH00169: caught SIGTERM, shutting down
    

How to check which services are listening

It's just netstat -an | grep LISTEN. See: https://stackoverflow.com/q/44961792/2066546

Resolution

Make sure only the server apache is running:

launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist
launchctl enable /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/com.apple.serviceproxy.plist    

Then try to re-initialize the server data as shown in https://gist.github.com/fiedl/3e8e06889029d9544e35c689700629ba and make sure that /Library/Server/Calendar and Contacts/Data is owned by the _calendar user.

Further resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment