Configuration
The server starts on 127.0.0.1:8080 with plain HTTP/1.1. Create a profile when you want to change that behavior. A profile can contain just the settings your application needs.
What do you want to change?
Start and connect
Run on another portKeep a development server on localhost while a second app uses port 8080.Use an HTTPS certificateServe a domain using an existing PEM certificate and private key.Operate the server
Manage a worker poolStart two workers, inspect their status and request a rolling replacement.Limit expensive requestsGive report requests a budget while keeping unrelated routes available.Trace requests with APMConnect a tracing backend and find a request from a PHP handler.Enable runtime featuresEnable a capability where supported and inspect its resolved state.Serve a frontend
Publish static filesMap a browser URL to a CSS file and verify the contents.Cache assetsLet a browser reuse a download and validate it with an ETag.Compress JSONReturn a compressed API response to a client that accepts gzip.Set up CORSAnswer a preflight from a frontend hosted on another origin.Apply a profile
For example, to move the local server to port 9000, save this entire file as server.json next to your project’s vendor/ directory.
{
"listen": { "port": 9000 }
}php vendor/mini4work/webserver/examples/server.php server.jsonIn a second terminal, run curl http://127.0.0.1:9000/. The bundled handler returns JSON. Restart with the profile after editing it.
How the server reads a profile
At startup the server merges JSON objects with the installed package’s config/full.jsonc. In this example the default host is retained. A supplied list replaces the entire default list. Relative paths resolve from the directory containing the profile.
Use .jsonc for line or block comments. Inside a string, ${NAME} reads an environment variable at startup. Missing variables, unknown keys and incompatible values produce configuration errors. Point your editor at the package’s config/schema.json for completion.
Look up a setting
Browse configuration keys by topic
Connections
Change the address or portlisten.host · listen.portSelect an HTTP versionprotocols.http · protocols.http1 · protocols.http2 · protocols.http3Set up HTTPS certificatestls.mode · tls.local · tls.files · tls.acme · tls.storage · tls.renew_before_daysFiles and responses
Serve CSS, images and other assetsstatic.directories · static.public_dirCache and revalidate assetsstatic.directories · cache_control · etagCompress an application responsecompression.modeSet up CORScors.headersCapacity and operations
Size the worker poolworkers.count · workers.max_connections · workers.listen_backlog · workers.userRetire and replace workersworkers.rotationLimit expensive requestsprotection.endpointsInspect or restart the servercontrol.socketConfigure log outputlogging.levelTrace requests with APMobservability.apmEnable optional runtime featuresfeature