How to do i create subdomains for lighttpd ubuntu 14x?

December 19, 2015 2k views
Deployment Linux Basics Miscellaneous Server Optimization Ubuntu

Hi guys,

I want to know to create subdomains for my lighttpd web server, please guide me through the easiest possible way. I've seen few tutorials about this but half of them are outdated and other half are really hard to understand.

Ubuntu 14.x
Lighttpd latest version


1 comment
1 Answer

There are a number of ways to do this, but the easiest is probably to use the "Simple Vhost" module. On Ubuntu, you can enable it by running:

  • sudo lighty-enable-mod simple-vhost
  • sudo service lighttpd force-reload

Next edit the file: /etc/lighttpd/conf-enabled/10-simple-vhost.conf Here you can set the base "server root" and the "document root."

simple-vhost.server-root = "/var/www" 
simple-vhost.document-root = "/htdocs/" 

In this example, domains found in the /var/www directory will serve content found in the /htdocs/ directory. For example, if your sub-domains are and you would put the files you want to serve in the coorisponding directories:

Have another answer? Share your knowledge.