micro_httpd(8)

πŸ’… micro_httpd(8) β€” System Manager's Manual πŸ’…

okay so bestie, buckle up: this is micro_httpd(8) from the System Manager's Manual, and it's about a really small HTTP server. Like, tiny tiny. ✨

🌸 NAME 🌸

micro_httpd β€” really small HTTP server. That's it, that's the name, no cap. 🫢

✨ SYNOPSIS ✨

micro_httpd directory

πŸ’– DESCRIPTION πŸ’–

micro_httpd is a very small HTTP server. It runs from inetd, which means its performance is poor. But for low-traffic sites, it's 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.

All in 150 lines of code. iconic behavior, honestly. πŸ’…

To install it, add a line like this to /etc/inetd.conf:

micro_http  stream tcp nowait nobody  /usr/local/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. Then add a 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. Then restart inetd by sending it a HUP signal, or rebooting.

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 assumes there's either a bug or 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'll 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.

ngl, that spawn-rate thing is giving "the server needs a lil timeout" energy 😭 watch the logs, bestie.

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/local/sbin/micro_httpd --  micro_httpd dir

Make sure the paths to the certificate and executable are correct, and again don't forget to change dir to the directory you want to serve.

as root? yes bestie, that's what the page says β€” be careful with your paths. πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

Copyright Β© 1999 by Jef Poskanzer <jef@mail.acme.com>. All rights reserved.


That's the whole micro_httpd(8) page from the System Manager's Manual, dated 15 March 1999 β€” tiny server, big main-character energy. πŸ’–βœ¨

πŸ“¦ where this page comes from