MacOS – Unnable to start new WebApp with webappctl on OSX Server

apachemacosPROXYweb app

Question

Is there anything else needed other than creation of "mywebapp.plist" in the "/Library/Server/Web/Config/apache2/webapps" and starting it with "sudo webappctl start" command in order to register and start new web application ?

Do we need somehow register it anywhere (like Server.app/Webapps) before starting with webappctl?

If not, what can cause this problem?

Description

We have a webapp running on port 8085 and want to put it behind apache proxy/reverseproxy. However we failed to start the new webapp using webappctl.
Output in console was an error:

web:error = "CANNOT_START_SERVICE_ERR"

system.log contains that:

xswebconfig failed: EXCEPTION: No place to put SSL directives, vhost www.ontometrics.com

servermgr_web: XSWebConfig sync failed; detail:Error Domain=XSServerFoundationErrorDomain Code=7 "Failed to write settings." UserInfo={NSLocalizedDescription=Failed to write settings.}

In order to check if there are some issues with our webapp plist we created a copy of the "/Library/Server/Web/Config/apache2/webapps/com.apple.webapp.wiki.plist" and updated only "name" parameter inside

<key>name</key>
<string>com.example.wiki</string>

Then started it with "sudo webappctl start com.example.wiki" – and it give the same error in the log.
Of course "original wiki" app started just fine

sudo webappctl start com.apple.webapp.wiki

Here is what in the "system.log".

Aug 26 04:53:42 ontoserver sudo[47931]:   andrey : TTY=ttys003 ; PWD=/Library/Server/Web/Config/apache2/webapps ; USER=root ; COMMAND=/Applications/Server.app/Contents/ServerRoot/usr/sbin/webappctl start com.example.wiki
Aug 26 04:53:42 ontoserver serveradmin[47934]: Connected to the Notify Service
Aug 26 04:53:42 ontoserver servermgr_web[47850]: validating connection from 0 : 47500
Aug 26 04:53:42 ontoserver servermgr_web[47850]: xswebconfig failed: EXCEPTION: No place to put SSL directives, vhost www.ontometrics.com (
                0   CoreFoundation                      0x00007fff8ebff4f2 __exceptionPreprocess + 178
                1   libobjc.A.dylib                     0x00007fff8e73a73c objc_exception_throw + 48
                2   CoreFoundation                      0x00007fff8ebff439 -[NSException raise] + 9
                3   ServerFoundation                    0x0000000100648d8d -[WebVHost reconstruct] + 10543
                4   ServerFoundation                    0x0000000100640416 -[ConfigFile write] + 203
                5   ServerFoundation                    0x0000000100645811 -[WebVHost write] + 1601
                6   ServerFoundation                    0x0000000100652377 -[WebConfig setSettings:] + 12779
                7   ServerFoundation                    0x000000010065606f -[WebConfig write:] + 297
                8   ServerFoundation                    0x00000001005de934 -[XSWebConfig synchronizeAndReturnError:] + 188
                9   servermgr_web                       0x00000001009e8d35 set_webapp_state_with_webconfig + 1326
                10  servermgr_web                       0x00000001009e97d5 set_webapp_state_variant + 187
                11  servermgr_web                       0x00000001009eb109 -[servermgr_web setWebAppStateWithRequest:] + 204
                12  CoreFoundation                      0x00007fff8eb70a6c __invoking___ + 140
                13  CoreFoundation                      0x00007fff8eb708fe -[NSInvocation invoke] + 286
                14  libservermgrcommon.dylib            0x00000001005a3300 -[PluginRequestHandler doProcessInputWithRequest:context:lockFileFD:] + 3304
                15  libservermgrcommon.dylib            0x000000010059c326 __45-[GenericPlugin doCommand:forUser:withReply:]_block_invoke + 646
                16  libdispatch.dylib                   0x00007fff8d88d93d _dispatch_call_block_and_release + 12
                17  libdispatch.dylib                   0x00007fff8d88240b _dispatch_client_callout + 8
                18  libdispatch.dylib                   0x00007fff8d88703b _dispatch_queue_drain + 754
                19  libdispatch.dylib                   0x00007fff8d88d707 _dispatch_queue_invoke + 549
                20  libdispatch.dylib                   0x00007fff8d885d53 _dispatch_root_queue_drain + 538
                21  libdispatch.dylib                   0x00007fff8d885b00 _dispatch_worker_thread3 + 91
                22  libsystem_pthread.dylib             0x00007fff8da484de _pthread_wqthread + 1129
                23  libsystem_pthread.dylib             0x00007fff8da46341 start_wqthread + 13
        )
Aug 26 04:53:42 ontoserver servermgr_web[47850]: servermgr_web: XSWebConfig sync failed; detail:Error Domain=XSServerFoundationErrorDomain Code=7 "Failed to write settings." UserInfo={NSLocalizedDescription=Failed to write settings.}

Info

OS X version: El Capitan 10.11.6

Apache server version: 2.4.18

Best Answer

Problem has been resolved once SSL certificate was generated (with letsencrypt.org) and installed in the "Server.app / Certificates". After that has been done "webappctl start myapp.plist" just start working without errors for new webapps plists.