Ignacio Torres Masdeu

Lighttpd + DNS + external email and dns accelerator setup

Switching off the lights

$ sudo svcadm disable apache2
$ sudo svcadm disable webmin


Now that the room is tidy let’s configure our email (optional if you are using Google Apps for your domain).

Edit /opt/csw/etc/postfix/main.cf and modify/add the following parameters:

myhostname = accelerator.mydomain.net
virtual_alias_domains = mydomain.net otherdomain.tld yetanotherdomain.tld

Edit /opt/csw/etc/postfix/virtual and add your address maps, addresses with only @domain.tld are catch-all addresses:

me@mydomain.net me@gmail.com
you@domain.tld you@anotherhost.com
@mydomain.tld myspammedmailbox@gmail.com

Regenerate the hash table of virtual addresses and restart postfix:

$ sudo postmap /opt/csw/etc/postfix/virtual
$ sudo svcadm restart postfix


Create a /etc/named.conf file and your zones in /var/named/. You have bind templates in textsnippets.

Generate a rndc password

$ dnssec-keygen -a hmac-md5 -b 256 -n HOST mybrandnewkey

The result will be something like “K%2Ftmp%2Fmybrandnewkey.+157+42885”. Read K%2Ftmp%2Fmybrandnewkey.+157+42885.private and put the key in /etc/rndc.key:

key "rndc-key" {
        algorithm hmac-md5;
        secret "Hr1U28EsMhp8r0TEEjAmksoldReEYuiWwQFH0/gkk6I=";

Generate /var/named/named.root with:

$ dig @e.root-servers.net . ns > /var/named/named.root

And start your DNS server:

$ sudo svcadm enable dns/server


Now edit /opt/csw/etc/lighttpd.conf to suit your needs. You have plenty of lighttpd.conf examples in textsnippets. You can use /opt/csw/php5/bin/php-cgi in your fastcgi configuration.

And, you guessed it, start lighttpd:

$ sudo svcadm enable network/lighttpd

You can check your services with:

$ sudo svcs -a
$ sudo svcs -xv

Now you can get an account on everydns.net and create a secondary domain pointing to your accelerator. You can also use the secondary dns services of gandi.net or your dns provider/registrar of choice.