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

Including Variables, Files, and Shell-code


Lighttpd allows us to define and use variables in its configuration files. To make it easier to distinguish between a configuration option and a variable, you have to prefix your variables with var. as in var.docroot. Later on, you can use them by simply putting them in place of whatever value you have given them. For example:

var.docroot = "/var/www"
server.document-root = var.docroot

This can be useful if you have values that appear in a lot of places. Just put them in a variable and if you need to change the value, you only need to change it in one place. We can also set and get variables of the environment. The env namespace is reserved for this:

server.document-root = env.HOME + "/htdocs" # for a user dir
server.document-root = env.LIGHTTPD_BASE + var.htmldir
# to use an environment variable

You can also include files with an include statement:

include "some.conf"

This tells Lighttpd to parse the contents of some.conf as if they were in place...