Lighttpd Configure Subdomain

I‘ve main domain configured at and I’d like to use with different files. How do I add subdomain support with Lighttpd web server under UNIX or Linux operating systems?

You can setup lighttpd server as follows:

  • will use /home/lighttpd/ as document root
  • will use /home/lighttpd/ as document root

Both domain can point to the same ip address or different ip address. Edit lighttpd.conf, enter:
# vi /etc/lighttpd/lighttpd.conf
Update / edit as follows:

server.modules              = (
server.errorlog            = "/var/log/lighttpd/error.log"
accesslog.filename         = "/var/log/lighttpd/access.log"
index-file.names            = ( "index.php", "index.html", "index.htm", "default.htm" )
server.tag                 = "lighttpd"
server.document-root = "/home/lighttpd/"
server.username = "lighttpd"
server.groupname = "lighttpd"
server.port = "80"
server.bind = ""  
###### Subdomain settings ##############
$HTTP["host"]  == ""{
        server.document-root = "/home/lighttpd/"
        accesslog.filename         = "/var/log/lighttpd/"

Save and close the file. Create required directories for subdomain:
# mkdir -p /home/lighttpd/
# mkdir /var/log/lighttpd/

Reload or restart the lighttpd server:
# /etc/init.d/lighttpd reload
You can now upload all files at /home/lighttpd/ for

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts