micro-httpd(8)

πŸ“¦
this version Β· 4 versions
, in ubuntu jammy, ubuntu noble

πŸ’– micro-httpd β€” the NAME section, bestie ✨

okay so hi!! this is micro-httpd and it's literally a really small HTTP server πŸ¦‹ that's it that's the whole name, no notes, periodt.


🌸 SYNOPSIS 🌸

  micro-httpd DIRECTORY

that's the whole vibe. one argument. one directory. go off πŸ‘‘


✨ OPTIONS ✨

None. πŸ’…

no flags. no long options. nothing to memorize. she simply does not have options, and honestly? iconic behaviour. not every server needs 47 toggles to feel valid 🫢


πŸŽ€ DESCRIPTION πŸŽ€

micro-httpd is a very small HTTP server β€” like, the entire thing is 150 lines of code. one hundred and fifty. that's shorter than some people's .bashrc. 😭

the catch: it runs from inetd, which means its performance is poor. no cap. but if your site is low-traffic, it's quite adequate β€” genuinely, it's fine, it's eating, it's serving.

and the way that it still implements all the basic features of an HTTP server?? obsessed:

  • Security against ".." filename snooping. πŸ›‘οΈ (so nobody goes sneaking up the directory tree, we love a secure queen)
  • The common MIME types.
  • Trailing-slash redirection.
  • index.html
  • Directory listings.

πŸ’œ how to install her (the inetd.conf era)

to install it, you 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 (fr fr, double-check it), and change "dir" to be the directory you want to serve. like, the actual directory. the one with your stuff in it. πŸ“

you could also 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. dealer's choice bestie ✨

then restart inetd by sending it a "HUP" signal. bye girl, go reload πŸ’«

😭 the spawn-rate drama (read this one)

on some systems, inetd has a maximum spawn rate. so 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. she's dramatic like that.

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".

🌈 HTTPS?? yes actually πŸ’…

note that you can use micro-httpd to serve HTTPS, if you like, by running it from stunnel. yes, really. she contains multitudes.

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. (the original says "don not" β€” a whole typo, and honestly? we respect the hustle πŸ™ˆ)


πŸ¦‹ ENVIRONMENT πŸ¦‹

None. nothing. empty. the void. no environment variables here, she doesn't need them 🌸


⭐ FILES ⭐

None. literally none. not a single file listed. clean girl aesthetic πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group 🫢 go read about them too.


πŸ’– 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>.


and that's the whole page, bestie!! 🌈 this was micro-httpd from the User Commands crew, dated 2021-10-14 β€” mwah, go serve something cute πŸ’…βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from