Using thttpd to easily configure and run unpriviledged webserversThe popular webservers such as Apache2 and Ngnix have their merits, but quick configuration and ease of use are not among them. Fairly often I find myself wanting for a webserver for just a short test, and dont want the hassel of configuring apache. In times like these I turn to thttpd.
Thttpd is a handy little httpd that lacks some useful features (like trivial support for php or https), but has the advantage of being extremely easy to use. For example, let's launch a webserver rooted in /tmp/srv_path and visible at port 8080:
$ thttpd -d /tmp/srv_path/ -p 8080
Obviously, if your user has permissions to do so you may run it on port 80, or any port of your choosing.
Also, this is one of those peices of software that are very easy to configure, build, and install as an unpriviledged user into your home directory. On a standard linux system:
$ wget https://www.acme.com/software/thttpd/thttpd-2.29.tar.gz
$ tar xvf thttpd-2.29.tar.gz
$ cd thttpd-2.29
$ # now thttpd can be run simpy with ./thttpd
You may have noticed that the link to the source is https, but probably also hosted on thttpd. While it lacks trivial support for https its of course possible to manage this through more complicated means, but that's outside of the scope of this article.