SSL

To configure SSL it is essential to have a server certificate and a key. These can come from an official source or be self signed. For today's purposes we are going to need our site being served over SSL so we are going to add a self signed cert to our installation.

  1. Create a subFolder called cert. The name isn't special per se, this is just for organizational purposes.

  2. Create two empty text files 1. server.crt 2. server.key

  3. From the Server Key and Cert in the resources section, copy and paste the content into the corresponding file.

  4. Adapt your server.json ( either through CommandBox or directly ) with the following settings\

    {
        "web":{
            "bindings":{
                "SSL":{
                    "certFile":"cert/server.crt",
                    "keyFile":"cert/server.key",
                    "keyPass":"howdy",
                    "listen":"0.0.0.0:443"
                }
            },
            "host":"justenough.local",
            "http":{
                "port":"80"
            }
        }
    }
  5. Restart your server with the debug flag - server restart --debug - so we can see any errors as they happen. Note: You might need to cd to get back to your root folder otherwise we risk starting a second server or not restarting the one we've created.

  6. When the site opens, it might have a "Not Secure" flag up where the certificate is but this will work for our purposes. This is because of the self signed certificate, not CommandBox.

Last updated