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 3. More Virtual Hosting and CGI

In this chapter, we will learn:

  • How to set up virtual hosting

  • How to install MySQL server and configure with Lighttpd modules

  • How to configure SCGI and FastCGI with Lighttpd modules

Suppose that we want to host a lot of sites without restarting Lighttpd whenever a new site comes and goes. Given that all sites share the same configuration, we can do this using the line of mod_*vhost modules. To use them, we may include one of the following lines:

server.modules += ("mod_simple_vhost") # for simple virtual hosting
server.modules += ("mod_evhost") # for extended virtual hosting
server.modules += ("mod_mysqlvhost") # for virtual hosting with a MySQL database

The most basic, but an already usable module is mod_simple_vhost. With this simple virtual hosting solution, all we have to do is to supply a server root for virtual hosting, a default host name, and a document root, like this:

simple-vhost.server-root = "/var/www/vhost/"
simple-vhost.default-host = "myvirtualhost...