Report this

What is the reason for this report?

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

Posted on December 19, 2015

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

Adz



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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 blog.example.com and www.example.com you would put the files you want to serve in the coorisponding directories:

/var/www/blog.example.com/htdocs/
/var/www/www.example.com/htdocs/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.