Busybox HTTPD

I love busybox. It is super simple to compile, fully customizable. It even includes a web server! These are the steps I took to make it work, from source.

Make sure you have the following packages installed on your machine: git, gcc, make

Clone the repo:

$ git clone git://busybox.net/busybox.git

Compile the source:

$ cd busybox
$ make defconfig
$ make

If you have multicore, you can speed up compilation by running (for example if you have 4 cores):

$ make -j 4

Once done, you have an executable called ‘busybox’. Run it and you will see all the commands included. You run a command as follows, for example to open a vi text editor:

$ ./busybox vi

Now, to run a web server, the command is called httpd. Each command has a short help, called with the –help switch. For httpd:

$ ./busybox httpd --help
BusyBox v1.25.0.git (2016-02-11 12:45:41 GMT) multi-call binary.

Usage: httpd [-ifv[v]] [-c CONFFILE] [-p [IP:]PORT] [-u USER[:GRP]] [-r REALM] [-h HOME]
or httpd -d/-e/-m STRING

Listen for incoming HTTP requests

        -i              Inetd mode
        -f              Don't daemonize
        -v[v]           Verbose
        -p [IP:]PORT    Bind to IP:PORT (default *:80)
        -u USER[:GRP]   Set uid/gid after binding to port
        -r REALM        Authentication Realm for Basic Authentication
        -h HOME         Home directory (default .)
        -c FILE         Configuration file (default {/etc,HOME}/httpd.conf)
        -m STRING       MD5 crypt STRING
        -e STRING       HTML encode STRING
        -d STRING       URL decode STRING

So, you can launch a web server for example like this:

$ ./busybox httpd -p 8000 -h /path/to/www/pages

There are many more possibilities, including setting up mime types, running CGI scripts etc. More information can be found on the OpenWrt wiki site where the configuration file is explained in details.


Lire de tout

La majeure partie de mon temps libre se passe à lire. J’aime beaucoup de choses : jouer aux échecs, faire du piano, me ballader à vélo, pratiquer le yoga… mais mon activité préférée reste la lecture.

La lecture de quoi ?

Eh bien de tout, justement. Je passe allègrement d’un Dickens à un Bob Morane, du Gai savoir au Club des cinq ou des Essais de Montaigne aux Histoires extraordinaires de Pierre Bellemare.

La diversité de la production littéraire me fascine. Il y a bien sûr des livres et des auteurs que je n’aime pas. Mais je ne pense pas qu’il y ait un genre que je n’aime pas dans son ensemble, à part peut-être ce que les anglo-saxons nomment la romance. Mais sinon, philosophie, histoire, romans, livres pour ados, récits… tout me convient !