Lighttpd virtualhost configuration ~ name-based virtual hosting

www.lau‮c.irutt‬om
Lighttpd virtualhost configuration ~ name-based virtual hosting

Name-based virtual hosting allows you to host multiple websites on the same IP address using the same Apache server. To set up name-based virtual hosting in Lighttpd, you will need to create a separate configuration file for each virtual host and then include these configuration files in the main Lighttpd configuration file.

Here is an example of how to set up name-based virtual hosting in Lighttpd:

  1. Create a configuration file for each virtual host in the /etc/lighttpd/conf.d directory. For example, for a virtual host with the domain name example.com, you could create a configuration file named example.com.conf.

  2. In each virtual host configuration file, specify the document root for the virtual host and any other configuration options you want to apply to that virtual host. For example:

$HTTP["host"] == "example.com" {
    server.document-root = "/var/www/example.com"
}
  1. In the main Lighttpd configuration file (/etc/lighttpd/lighttpd.conf), include the virtual host configuration files by adding the following line:
include "conf.d/*.conf"
  1. Restart Lighttpd to apply the changes:
sudo service lighttpd restart

Now, when a request is made to the server, Lighttpd will use the domain name in the request to determine which virtual host to serve.

Created Time:2017-10-29 22:08:50  Author:lautturi