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

CGI with mod_cgi


To enable CGI in Lighttpd, we need to include and configure the module. For example, we might want to execute all files with the cgi extension:

server.modules += ("mod_cgi")
cgi.assign = (".cgi" => "")

The "" in cgi.assign means that CGI scripts are started in their own shell. Otherwise, this entry would contain the path to the CGI interpreter/application.

We probably want to add index.cgi to the list of index files:

server.indexfiles = ("index.cgi", "index.html")

Alternatively, we might prefer putting all CGI programs in one directory instead of distinguishing them by extension:

cgi.assign = ("/cgi-bin/" => "") # Patterns starting with "/" match the path.

If the CGI protocol is very simple, why should the configuration be any more complex?