Skip to content

Environment Variables

The server can be configured via the following environment variables.


  • Environment variables are equivalent to their command-line arguments.
  • Command-line arguments take precedence over their equivalent environment variables.


The address of the host (E.g Default [::].


The port of the host. Default 80.


Optional file descriptor number (e.g. 0) to inherit an already-opened TCP listener on (instead of using SERVER_HOST and/or SERVER_PORT). Default empty (disabled).


Relative or absolute root directory path of static files. Default ./public.


The Server configuration file path is in TOML format. See The TOML Configuration File.


Defines a grace period in seconds after a SIGTERM signal is caught which will delay the server before shutting it down gracefully. The maximum value is 255 seconds. The default value is 0 (no delay).


Specify a logging level in lower case. Possible values are error, warn, info, debug or trace. Default error.


Log incoming requests information along with its Remote Address (IP) if available using the info log level.


HTML file path for 404 errors. If the path is not specified or simply doesn't exist then the server will use a generic HTML error message. Default ./public/404.html.


HTML file path for 50x errors. If the path is not specified or simply doesn't exist then the server will use a generic HTML error message. Default ./public/50x.html


HTML file path that is used for GET requests when the requested path doesn't exist. The fallback page is served with a 200 status code, useful when using client routers (E.g React Router). If the path is not specified or simply doesn't exist then this feature will not be active.


The number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula: worker threads = number of CPUs * n where n is the value that changes here. When the multiplier value is 0 or 1 then the number of CPUs is used. The number of worker threads result should be a number between 1 and 32,768 though it is advised to keep this value on the smaller side. Default one thread per core.


Enable HTTP/2 with TLS support. Make sure also to adjust the current server port. Default false (disabled).


Specify the file path to read the certificate. Default empty (disabled).


Specify the file path to read the private key. Default empty (disabled).


Specify an optional CORS list of allowed origin hosts separated by commas. Host ports or protocols aren't being checked. Use an asterisk (*) to allow any host. Default empty (disabled).


Specify an optional CORS list of allowed HTTP headers separated by commas. It requires SERVER_CORS_ALLOW_ORIGINS to be used along with. Default origin, content-type.


Gzip, Deflate or Brotli compression on demand determined by the Accept-Encoding header and applied to text-based web file types only. See ad-hoc mime-type list. Default true (enabled).


Enable directory listing for all requests ending with the slash character (‘/’). Default false (disabled).


Specify a default code number to order directory listing entries per Name, Last modified or Size attributes (columns). Code numbers supported: 0 (Name asc), 1 (Name desc), 2 (Last modified asc), 3 (Last modified desc), 4 (Size asc), 5 (Size desc). Default 6 (unordered).


Enable security headers by default when HTTP/2 feature is activated. Headers included: Strict-Transport-Security: max-age=63072000; includeSubDomains; preload (2 years max-age), X-Frame-Options: DENY, X-XSS-Protection: 1; mode=block and Content-Security-Policy: frame-ancestors 'self'. Default false (disabled).


Enable cache control headers for incoming requests based on a set of file types. The file type list can be found on src/ file. Default true (enabled).


It provides The "Basic" HTTP Authentication Scheme using credentials as user-id:password pairs, encoded using Base64. Password must be encoded using the BCrypt password-hashing function. Default empty (disabled).


Check for a trailing slash in the requested directory URI and redirect permanent (308) to the same path with a trailing slash suffix if it is missing. Default true (enabled).


The following options and commands are Windows platform-specific.


Run the web server in a Windows Service context. See more details.

Back to top