Use an HTTPS certificate
← All configuration scenariosYou already have a certificate for your domain and want Mini4Work to terminate TLS. This example tests it on the loopback listener before you expose it to clients. Use a PHP CLI with OpenSSL enabled.
Place the certificate and key
Next to vendor/, create a certs/ directory. Place the PEM certificate chain, leaf first, in certs/fullchain.pem and its matching private key in certs/privkey.pem. Give the server account read access and keep the key outside public asset directories.
Enable TLS
Save this as https.json beside certs/. The server resolves both paths relative to that profile.
{
"listen": { "port": 9000 },
"tls": {
"mode": "files",
"files": {
"certificate": "certs/fullchain.pem",
"private_key": "certs/privkey.pem"
}
}
}php vendor/mini4work/webserver/examples/server.php https.jsonCheck the handshake
Replace app.example.com with the name on your certificate. Run this on the server machine. The request connects locally while curl verifies the certificate for that hostname.
curl --resolve app.example.com:9000:127.0.0.1 \
-i https://app.example.com:9000/helloExpect HTTP/1.1 200 and the inspection handler’s JSON. If a private CA issued the certificate, add --cacert /path/to/public-root.pem. If you need HTTP/2 or HTTP/3, follow the protocol setup guides for their additional dependencies.