1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
# Copyright
#
# Copyright (C) 2007-2009 Jari Aalto
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Description
#
# To learn what TOP LEVEL section to use in manual pages,
# see POSIX/Susv standard and "tility Description Defaults" at
# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11
#
# This is manual page in Perl POD format. Read more at
# http://perldoc.perl.org/perlpod.html or run command:
#
# perldoc perlpod | less
#
# To check the syntax:
#
# podchecker *.pod
#
# Create manual page with command:
#
# pod2man PAGE.N.pod > PAGE.N
=pod
=head1 NAME
micro-httpd - really small HTTP server
=head1 SYNOPSIS
micro-httpd DIRECTORY
=head1 OPTIONS
None.
=head1 DESCRIPTION
micro-httpd is a very small HTTP server all in 150 lines of code. It
runs from inetd, which means its performance is poor. But for
low-traffic sites, it is quite adequate. It implements all the basic
features of an HTTP server, including:
* Security against ".." filename snooping.
* The common MIME types.
* Trailing-slash redirection.
* index.html
* Directory listings.
To install it, add a line like this to /etc/inetd.conf:
micro-http stream tcp nowait nobody \
/usr/sbin/micro-httpd micro-httpd dir
Make sure the path to the executable is correct, and change "dir" to
be the directory you want to serve. You could add line like this to
/etc/services:
micro-http port/tcp #Micro HTTP server
Change "port" to the port number you want to use: 80, 8000, whatever.
Restart inetd by sending it a "HUP" signal.
On some systems, inetd has a maximum spawn rate - if you try to run
inetd services faster than a certain number of times per minute, it
assumed there is either a bug of an attack going on and it shuts down
for a few minutes. If you run into this problem - look for syslog
messages about too-rapid looping - you will need to find out how to
increase the limit. Unfortunately this varies from OS to OS. On
FreeBSD, you add a "-R 10000" flag to inetd's initial command line. On
some Linux systems, you can set the limit on a per-service basis in
inetd.conf, by changing "nowait" to "nowait.10000".
Note that you can use micro-httpd to serve HTTPS, if you like, by
running it from stunnel. First fetch and install stunnel - FreeBSD
users can just go to /usr/ports/security/stunnel and do a "make cert ;
make install". Then as root run:
stunnel -p /usr/local/certs/stunnel.pem -d 443 -l \
/usr/sbin/micro-httpd -- micro-httpd dir
Make sure the paths to the certificate and executable are correct, and
again don not forget to change "dir" to the directory you want to
serve.
=head1 ENVIRONMENT
None.
=head1 FILES
None.
=head1 SEE ALSO
inetd(8)
micro-inetd(8)
xinetd(8)
=head1 AUTHORS
Copyright (C) 1999 Jef Poskanzer <jef@mail.acme.com>. All rights
reserved.
This manual page was updated by Jari Aalto <jari.aalto@cante.net>.
Released under license GNU GPL v2 or (at your option) any later
version. For more information about license, visit
<http://www.gnu.org/copyleft/gpl.html>.
=cut
|