So something like this?
Code:
#!/bin/bash
domain=${1%.*}
tld=${1#*.}
cat <<HERE
#
# $domain.$tld
#
\$HTTP["host"] =~ "(^|\.)$domain\.$tld\$" {
server.document-root = "/home/$domain/public_html"
server.errorlog = "/var/log/lighttpd/${domain}-error.log"
accesslog.filename = "/var/log/lighttpd/${domain}-access.log"
server.error-handler-404 = "/e404-$domain.php"
}
HERE