Lighttpd both http and https

 

We can configure both http & https on lighttpd webserver.

Use following configuration to serve both http & https requests:

server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
accesslog.filename = "/var/log/lighttpd/access.log"
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80

#Configuration for https
$SERVER["socket"] == ":443" {
  ssl.engine = "enable"
  ssl.pemfile = "/etc/lighttpd/certs/www.example.com.pem"
}

In above configuration http://www.example.com.pem file should contain both the private key and the certificate.

After updating lighttpd.conf file restart lighttpd:

$ service lighttpd restart

After restarting both http & https should work for your host.

Leave a comment