simply add include "incl-domains.conf" to your main lighttpd.conf file
#!/usr/bin/env ruby -w # # light_conf_editor.rb # # Created by yo on 25.12.05. # # # Description # Creates lighttpd conf files # # usage: light_conf_editor add || remove domainname username # example: light_conf_editor add bigcurl.com yo # example: light_conf_editor remove bigcurl.com yo path_to_lighttpd_conf="/etc/lighttpd" def remove_include_from_conf(domainname, username, path_to_lighttpd_conf) temp_file="" File.open("#{path_to_lighttpd_conf}/incl-domains.conf", "a+") unless FileTest.exist?("#{path_to_lighttpd_conf}/incl-domains.conf") File.open("#{path_to_lighttpd_conf}/incl-domains.conf", "r") do |file| file.each_line do |line| temp_file.concat(line) unless line.include? "include \"domains/#{username}/#{domainname}.conf\"" end end File.open("#{path_to_lighttpd_conf}/incl-domains.conf", "w") do |file| file.puts(temp_file) end end def remove_conf_from_folder(domainname, username, path_to_lighttpd_conf) File.delete("#{path_to_lighttpd_conf}/domains/#{username}/#{domainname}.conf") if FileTest.exists?( "#{path_to_lighttpd_conf}/domains/#{username}/#{domainname}.conf" ) end def add_new_conf_in_folder(include_template, domainname, username, path_to_lighttpd_conf) Dir.mkdir( "#{path_to_lighttpd_conf}/domains") unless FileTest.directory?( "#{path_to_lighttpd_conf}/domains/" ) Dir.mkdir( "#{path_to_lighttpd_conf}/domains/#{username}/") unless FileTest.directory?( "#{path_to_lighttpd_conf}/domains/#{username}") aFile = File.new("#{path_to_lighttpd_conf}/domains/#{username}/#{domainname}.conf","w") aFile.puts(include_template) aFile.close end def add_new_include_in_conf(domainname, username, path_to_lighttpd_conf) File.open("#{path_to_lighttpd_conf}/incl-domains.conf", "a+") do |file| file.puts("include \"domains/#{username}/#{domainname}.conf\"") end end def show_usage print "usage: light_conf_editor add domainname username || remove domainname username\n" end if(ARGV.length < 3) show_usage exit(1) end domainname = ARGV[1] username = ARGV[2] if(ARGV[0]=="remove") remove_include_from_conf(domainname, username, path_to_lighttpd_conf) remove_conf_from_folder(domainname, username, path_to_lighttpd_conf) end if(ARGV[0]=="add") include_template = "$HTTP[\"host\"] =~ \"#{domainname}$\" { var.username = \"#{username}\" var.servername = \"#{domainname}\" include \"incl-docroot.conf\" server.dir-listing = \"enable\" dir-listing.hide-dotfiles = \"enable\" }" remove_include_from_conf(domainname, username, path_to_lighttpd_conf) remove_conf_from_folder(domainname, username, path_to_lighttpd_conf) add_new_conf_in_folder(include_template, domainname, username, path_to_lighttpd_conf) add_new_include_in_conf(domainname, username, path_to_lighttpd_conf) end