Running monkey httpd on AA1 under crunchbang

One of the things I liked about DSL was its inclusion of just about everything you’d ever need whether you wanted to use it as a desktop or a server. I figure from the posts in the forums that desktop use far outpaced server use but it’s quite capable as a server. DSL included everything from SSH and SSL to FTP server to a small HTTP daemon called monkey, which along with any of the other services could be started at boot from a cheatcode.

I think monkey was one of those things that kind of grew on me even though I’d often use thttpd (personal favorite). I’d use it at home for a variety of things including running a local bloxsom blog and hosting family calendars. I’d sometimes use it at work to test things and to set up a temporary server for our group. Despite its tiny size, monkey does CGI and can handle just about whatever you’d want a small HTTP daemon to do without any bloat and with easy configuration. It’s also been rock-solid in my experience, even with moderate traffic. I think you don’t need a full LAMP stack if your needs are fairly simple and you’re not setting up a production server with loads of traffic (and thttpd, which I think is more robust, should suffice if that’s the case).

I needed to look at something and needed to host it on my own network, so I looked to see if monkey is available in the Ubuntu repositories. It is, so I installed it.

The first thing I discovered is that its default conf file (/etc/monkey/monkey.conf) uses port 2001, which is kind of stupid (IMO). I edited it to a more suitable and easily remembered port (8080).

Once it’s set up the way you want, you can start the daemon:
sudo /etc/init.d/monkey start

Actually, you should first check to see if it’s started by default (see below) when you install it. Whether it is or isn’t, it’s safe to issue a stop before starting and/or reconfiguring it if you need to use a different configuration than its default. I think it’s fucked up to set things up to start automatically upon installation or even upon reboot unless/until the user decides to run it. Guess that’s why I still hate Ubuntu and the mindset of the user it attracts (I was going to add a post about this utter shitheadedness affecting the wider Ubuntu community the other day but I’m trying to be more diplomatic — really).

Once it’s started, you can point your browser to localhost:portnumber (e. g., http://localhost:8080) or even to your IP (if not proxied) to reach it from the Internet. Here’s the default monkey page:

screenshot-20090810102113

You can set up your own index.html and configure it as you see fit, including starting with a conf file in your home directory. Just copy the default in /etc/monkey to wherever you want to set it up (such as ~/.monkey). My own preference is to set things up in my home directory, so I have ~/www set up with a directory tree suited to my needs.

screenshot-20090810102056

Another thing (not surprising) I discovered about the Ubuntu package is that it’s set up to start at boot. I moved the S monkey file in my default runlevel (e.g., /etc/rc3.d/) to K. I don’t intend to run a full-time httpd so I’d just as soon start it manually as-needed. It’s not that big but it’s the thought that counts. Keep that in mind when using packages from the bloated distros. (Didn’t I write above that I’m trying to be more diplomatic? See? I didn’t repeat how totally fucked up I think it is to start these kinds of services without users taking full control of them first.)

Also, I noticed {Tiny,Micro}Core doesn’t have a package for monkey yet. I’ll probably add that to my compile list shortly.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: