Book Image

Lighttpd

By : Andre Bogus
Book Image

Lighttpd

By: Andre Bogus

Overview of this book

Table of Contents (20 chapters)
Lighttpd
Credits
About the Author
About the Reviewer
Preface
HTTP Status Codes

Chapter 12. Using Lua with Lighttpd

Now that we know how to attach most frameworks and applications to Lighttpd, it is time to have a look at a tiny, yet powerful scripting language, which can be used with FastCGI or directly integrated into Lighttpd.

Lua is one of the smallest scripting languages today (the whole distribution still fits on a floppy disk easily), and prides itself on being a meta-paradigm-language.

As of Lighttpd 1.3, a module for cache control added Lua as a programming language. This module was mod_cml (Cache Meta Language) and its purpose was restricted to control cache operation.

Since Lighttpd 1.4.7, this module has been superseded by mod_magnet, which allows Lua to manipulate the request and the reply with no startup cost. Instead it ties up the whole Lighttpd process while the script runs. Alternatively, there is a Lua/FastCGI application, by the author of Lighttpd, which reduces performance only a little, but runs outside the Lighttpd process.

If we have compiled our...