Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running lighttpd on Debian. Is there a way I can place my virtual host designations outside of the /etc/lighttpd/lighttpd.conf file? I want to try for a cleaner approach, as my file is getting a bit long.

share|improve this question
up vote 2 down vote accepted

You can split lighttpd vhost on multiple file as in apache..

For example you want to add two vhost configuration in two separate file, first you need to include this file in default /etc/lighttpd/lighttpd.conf :

1)At the bottom of the file, add:

include "domain1.com.conf"

include "domain2.net.conf"

2)Open /etc/lighttpd/domain1.com.conf file:

vi /etc/lighttpd/domain1.com.conf

Add following configuration directive:

$HTTP["host"] =~ "domain1\.com" { server.document-root = "/dir/to/www" accesslog.filename = "/dir/to/logs/access.log" }

Save and close the file.

repeat the same action for other domain2.net.conf, and so on ...

share|improve this answer
    
Perfect. Thanks! – muncherelli Aug 14 '10 at 23:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.