The very small erlang webserver
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

itty - The very small erlang webserver


Itty was written as a way for me to learn erlang. It’s aim is to eventually me a complete, but very lean webserver. The focus is not necessarily on speed, performance or security, but on a clear design that is easy to read through and understand.


I would like to include tutorials to take the reader through the step by step process of building up the webserver from its embryonic single process, to multiple processes working together to create a functioning webserver.

For Now

For now, itty is very incomplete. It’s configuration isn’t super flexible, the code is sloppy, and there is still plenty to fix. It is not necessarily a model of good Erlang, but it is a place to start looking at a simple, working webserver. It is stripped down to mostly its basics, so even if it isn’t pretty, it should be easily understandable.

Thank you

Thanks for checking this out. Feel free to send your comments to

Installation and Setup

What you need


  • Clone from thusly: “git clone git://”
  • Edit ‘application.cfg”
    • set the port (above 1024 if you aren’t running as root)
    • set the “docroot”, absolute path with no trailing slash
    • set the “http_logfile” and “event_logfile”
  • Make sure ‘index.html’ exists in your docroot (itty doesn’t do directory browsing yet)
  • “make run”
  • If all is well (and debugging is on) you will see a quick display of the current config and should be able to see the webserver on the appropriate port


  • [ ] itty / erlang doesn’t want to seem to give up the port it is bound to, right away, after closing out…it can take 5-10 sec until you can use the port again
  • [ ] dir browsing
  • [ ] there is a bug in template rendering, need to add absolute paths to config or have a fallback template to render when we cannot find the “real” templates
  • [ ] document (edoc see mochiweb for examples, makefile)
  • [ ] do something better with the template 404 and 500 pages
  • [ ] the actual codes for 404/500 appear to be passed around too much, look into this
  • [ ] actually use status 500 for something
  • [ ] need to clean up the relationship between “handler” and “serve_request”


  • [X] there is a little bug in the config checking of site.cfg, it doesn’t seem to work right if site.cfg is missing
  • [X] Added debugging
  • [X] checking if paths in config file actually exist, if they don’t log and error and bail
    • [X] have plain dir checking done
  • [X] initial modifications for windows makefile
  • [X] everytime config gets called it is reloading (See ?CONFIG) - we need to have this spawn its own module off
  • [X] “site” configs that override application.cfg
  • [X] add generic logging
  • [X] yep probably need a content type lol
  • [X] config file See -
  • [X] logging
  • [X] needs to try “index.html, index.html, etc”
  • [X] use records for datatypes
  • [X] Use error codes
  • [X] log in actual CLF - ehhh i implemented CEF (Close Enough Format)