There are a number of ways to do this, but the easiest is probably to use the “Simple Vhost” module. On Ubuntu, you can enable it by running:
- sudo lighty-enable-mod simple-vhost
- sudo service lighttpd force-reload
Next edit the file:
/etc/lighttpd/conf-enabled/10-simple-vhost.conf Here you can set the base “server root” and the “document root.”
simple-vhost.server-root = "/var/www"
simple-vhost.document-root = "/htdocs/"
In this example, domains found in the
/var/www directory will serve content found in the
/htdocs/ directory. For example, if your sub-domains are
www.example.com you would put the files you want to serve in the coorisponding directories: