Project

General

Profile

Virtual hosts inside SSL vs inside HTTP

Added by jpcaissy over 14 years ago

I am using lighttpd as a developpement server. For this purpose, I need my domain to point to different document root depending that it is SSL or HTTP.

So I have my own domain. When a request is made by normal HTTP I want it to point to a specific vhost. And when a request is done by HTTPS, it must point to a different vhost.

I have tried this normal configuration but it does not work. Both https:// and http:// end up pointing to the same document-root (the last one mentioned in my configuration file.

$HTTP["host"] =~ "domain.com" {
           server.document-root = "/home/me/symfony/web/" 
           server.indexfiles = ( "index.php", "index.html")
# Stripped #
        }

$SERVER["socket"] == "0.0.0.0:443" { # I tried my real ip, does not work either
        ssl.engine                 = "enable" 
        ssl.pemfile                = "/etc/lighttpd/keys/key.pem" 
        ssl.ca-file                = "/etc/lighttpd/keys/rapidssl_01.cer" 

        $HTTP["host"] =~ "domain.com"  {
                server.name = "piji.ca" 
                server.document-root = "/home/me/ssl/web/" 
         }
}

  • Using 1.4.23, compiled from source and added pcre and openssl binds on an Ubuntu Server 8.04