GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SHTTPD(1) FreeBSD General Commands Manual SHTTPD(1)

shttpd
lightweight web server

shttpd [options] [config_file]

shttpd -A htpasswd_file domain_name user_name password

shttpd is small, fast and easy to use web server with CGI, SSL, Digest Authorization support. It can be run as stand-alone server, be managed by inetd(8) , or be embedded into existing C/C++ application.

shttpd does not detach from terminal, and makes current working directory be the web root, unless -root option is specified.

Unlike other web servers, shttpd does not expect CGI scirpts to be put in a special directory. They may be anywhere. CGI files are recognized by the file extension.

SSI files are also recognized by extension. Currently, the only SSI directives supported are `<!--#include "url-encoded-path" -->' and `<!--#exec "program" -->'. The `url-encoded-path' can be relative to shttpd working directory, or absolute system path. In the embedded mode, more directives are available: #call, #if/#elif/#endif/#else/#endif. Unsupported SSI directives are silently ignored.

It is possible to specify multiple ports to listen on. For example, to make shttpd listen on HTTP port 80 and HTTPS port 443, one should start it as ‘shttpd -ssl_cert cert.pem -ports 80,443s’

shttpd can use the configuration file. By default, it is "shttpd.conf", and if it is present in the same directory where shttpd lives, the command line options are read from it. Alternatively, the configuration file may be specified as a last argument. The format of the configuration file is exactly the same as for the command line options, the only difference is that the command line options must be specified on separate lines, and leading dashes for option names must be omitted. Lines beginning with '#' are regarded as comments and ignored.

htpasswd_file domain_name user_name password
Add/edit user's password in the passwords file. Deleting users can be done with any text editor. Functionality similar to Apache's htdigest utility.
file
Access log file. Default: not set, no logging is done.
(+|-)x.x.x.x[/x],...
Specify access control list (ACL). ACL is a comma separated list of IP subnets, each subnet is prepended by '-' or '+' sign. Plus means allow, minus means deny. If subnet mask is omitted, like "-1.2.3.4", then it means single IP address. Mask may vary from 0 to 32 inclusive. Default: not set, allow all.
list
This options gives an ability to serve the directories outside web root by sort of symbolic linking to certain URI. The list must be comma-separated list of URI=PATH pairs, like this: "/etc/=/my_etc,/tmp=/my_tmp". Default: not set.
file
PUT and DELETE passwords file. This must be specified if PUT or DELETE methods are used. Default: not set.
file
Location of global passwords file. When set, per-directory .htpasswd files are ignored, and all accessed must be authorised against global passwords file. Default: not set.
domain_name
Authorization realm. Default: "mydomain.com".
uri
If set, shttpd creates special administrative URI where options may be changed at runtime. This URI probably wants to be password-protected, look at -protect option, and in the EXAMPLES section on how to do it. Default: not set.
list
Pass environment variables to the CGI script in addition to standard ones. The list must be comma-separated list of X=Y pairs, like this: "VARIABLE1=VALUE1,VARIABLE2=VALUE2". Default: not set.
list
Comma-separated list of CGI extensions. All files having these extensions are treated as CGI scripts. Default: "cgi,pl,php"
file
Force file to be a CGI interpreter for all CGI scripts. By default this option is not set, and shttpd decides which interpreter to use by looking at the first line of CGI script.
yes|no
Enable/disable directory listing. Default: "1" (enabled).
file
Error log file. Default: not set, no errors are logged.
yes|no
Enable/disable inetd mode. Default: "0" (disabled).
list
Additional to builtin mime types, in form "EXTENSION1=TYPE1,EXTENSION2=TYPE2".
port_list
Comma-separated list of ports to listen on. If the port is SSL, a letter 's' must be appeneded, for example, "80,443s" will open port 80 and port 443, and connections on port 443 will be SSL-ed. Default: 80
list
Comma separated list of URI=PATH pairs, specifying that given URIs must the protected with respected password files. Default: not set.
directory
Location of the WWW root directory. Default: working directory from which shttpd has been started.
list
Comma separated list of SSI extensions. Default: "shtml,shtm".
pem_file
Location of SSL certificate file. Default: not set.
yes|no
Hide console and put an icon on system tray (Windows only). Default: no.
num_threads
Number of worker threads. If 1, no threads are spawned, and shttpd operates as single threaded program. Default: 1.
login
Switch to given user after startup. Default: not set.

shttpd can be built as a library to embed web server functionality into C/C++ application. The API functions are declared in a header file shttpd.h. Please refer to the source package for a header file and the examples.

shttpd -root /var/www -ports 8080,8043s -ssl_cert /etc/cert.pem -aliases /aa=/tmp,/bb=/etc
Start listening on port 8080 for HTTP, and 8043 for HTTPS connections. Use /etc/cert.pem as SSL certificate file. Web root is /var/www. In addition, map directory /tmp to URI /aa, directory /etc to URI /bb.
shttpd -acl -0.0.0.0/0,+10.0.0.0/8,+1.2.3.4
Deny connections from everywhere, allow only IP address 1.2.3.4 and all IP addresses from 10.0.0.0/8 subnet to connect.
shttpd -ports 8080 -cfg_uri /ctl -protect /ctl=/tmp/passwords.txt
Start listening on port 8080, create an administrative URI "/ctl" where options may be changed at runtime, and protect that URI with authorization.
http stream tcp nowait nobody /bin/shttpd shttpd -inetd 1 -root /var/www
This line in /etc/inetd.conf makes shttpd run by inetd(8) daemon.

inetd(8).

shttpd is licensed under the terms of beerware license.

Sergey Lyubka ⟨valenok@gmail.com⟩.
February 12, 2008

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.