:- use_module(library(http/http_unix_daemon)).
http_daemon
--http=Spec or --https=Spec is followed by
arguments for that server until the next --http=Spec or --https=Spec
or the end of the options.--http=Spec or --https=Spec appears,
one HTTP server is created from the specified parameters.
Examples:
--workers=10 --http --https --http=8080 --https=8443 --http=localhost:8080 --workers=1 --https=8443 --workers=25
--user=User
to open ports below 1000. The default port is 80. If --https
is used, the default port is 443.--ip=localhost to restrict access to connections from
localhost if the server itself is behind an (Apache) proxy server
running on the same host.
socket(s)--pwfile=File)--user. If omitted, the login
group of the target user is used.--no-fork or --fork=false, the
process runs in the foreground.|Port|BindTo:Port)]true, create at the specified or default address. Else use
the given port and interface. Thus, --http creates a server
at port 80, --http=8080 creates one at port 8080 and --http=localhost:8080
creates one at port 8080 that is only accessible from localhost.|Port|BindTo:Port)]--http, but creates an HTTPS server. Use --certfile, --keyfile, -pwfile,
--password and --cipherlist to configure SSL
for this server.--password=PW as it allows using file
protection to avoid leaking the password. The file is read before
the server drops privileges when started with the --user
option.true (default false) implies --no-fork
and presents the Prolog toplevel after starting the server.kill -HUP <pid>. Default is reload
(running make/0). Alternative is quit,
stopping the server.Other options are converted by argv_options/3 and passed to http_server/1. For example, this allows for:
http_daemon/0 is defined as
below. The start code for a specific server can use this as a starting
point, for example for specifying defaults or additional options. This
uses guided options processing from argv_options/3
from library(main). The option definitions are available as http_opt_type/3, http_opt_help/2
and
http_opt_meta/2
http_daemon :-
current_prolog_flag(argv, Argv),
argv_options(Argv, _RestArgv, Options),
http_daemon(Options).