LinuxCommandLibrary

darkhttpd

darkhttpd

TLDR

Start server serving the specified document root

$ darkhttpd [path/to/docroot]
copy


Start server on specified port (port 8080 by default if running as non-root user)
$ darkhttpd [path/to/docroot] --port [port]
copy


Listen only on specified IP address (by default, the server listens on all interfaces)
$ darkhttpd [path/to/docroot] --addr [ip_address]
copy

Help

darkhttpd/1.13, copyright (c) 2003-2021 Emil Mikulic. 
usage: darkhttpd /path/to/wwwroot [flags] 

flags: --port number (default: 8080, or 80 if running as root) 
Specifies which port to listen on for connections. 
Pass 0 to let the system choose any free port for you. 

--addr ip (default: all) 
If multiple interfaces are present, specifies 
which one to bind the listening port to. 

--maxconn number (default: system maximum) 
Specifies how many concurrent connections to accept. 

--log filename (default: stdout) 
Specifies which file to append the request log to. 

--chroot (default: don't chroot) 
Locks server into wwwroot directory for added security. 

--daemon (default: don't daemonize) 
Detach from the controlling terminal and run in the background. 

--index filename (default: index.html) 
Default file to serve when a directory is requested. 

--no-listing 
Do not serve listing if directory is requested. 

--mimetypes filename (optional) 
Parses specified file for extension-MIME associations. 

--default-mimetype string (optional, default: application/octet-stream) 
Files with unknown extensions are served as this mimetype. 

--uid uid/uname, --gid gid/gname (default: don't privdrop) 
Drops privileges to given uid:gid after initialization. 

--pidfile filename (default: no pidfile) 
Write PID to the specified file.  Note that if you are 
using --chroot, then the pidfile must be relative to, 
and inside the wwwroot. 

--no-keepalive 
Disables HTTP Keep-Alive functionality. 

--forward host url (default: don't forward) 
Web forward (301 redirect). 
Requests to the host are redirected to the corresponding url. 
The option may be specified multiple times, in which case 
the host is matched in order of appearance. 

--forward-all url (default: don't forward) 
Web forward (301 redirect). 
All requests are redirected to the corresponding url. 

--no-server-id 
Don't identify the server type in headers 
or directory listings. 

--timeout secs (default: 30) 
If a connection is idle for more than this many seconds, 
it will be closed. Set to zero to disable timeouts. 

--auth username:password 
Enable basic authentication. 

--ipv6 
Listen on IPv6 address. 

Copied to clipboard