[Mongrel] Mongrel Lighttpd and SSL

snacktime snacktime at gmail.com
Thu Aug 17 15:14:08 EDT 2006


Here is an example of doing ssl and non ssl in the same instance.
Note the use of $SERVER["socket"] and HTTP["host"].  You can use both
of those for one virtual host like I did below.  The host setting sets
the options that are common to both ssl and non ssl, and the socket
settings are port specific.  Lots of different combinations are
possible.



var.base = "/tmp/"
server.document-root     = var.base
server.modules           = ( "mod_rewrite", "mod_accesslog",
"mod_fastcgi", "mod_compress", "mod_expire" )


compress.filetype        = ( "text/plain", "text/html", "text/css",
"text/javascript" )

expire.url               = ( "/favicon.ico"  => "access 3 days",
                             "/javascripts/" => "access 3 days" )

var.app1 = "/usr/local/www/seca/web/"
$HTTP["host"] == "test.domain.com" {
fastcgi.server      = ( ".fcgi" => ( "localhost" => (
    "min-procs"       => 1,
    "max-procs"       => 1,
    "socket"          => var.app1 + "tmp/sockets/fcgi.socket",
    "bin-path"        => var.app1 + "public/dispatch.fcgi",
    "bin-environment" => ( "RAILS_ENV" => "development" )
) ) )
}

$SERVER["socket"] == "72.25.136.58:80" {
    server.name     = "test.domain.com"
    server.error-handler-404 = "/dispatch.fcgi"
    accesslog.filename       = var.app1 + "log/lighttpd.access.log"
    compress.cache-dir       = var.app1 + "tmp/cache"
}
$SERVER["socket"] == "72.25.136.58:443" {
    ssl.ca-file     = var.app1 + "ssl/ca.pem"
    server.name     = "test.domain.com"
    server.error-handler-404 = "/dispatch.fcgi"
    server.document-root     = var.app1 + "public/"
    server.errorlog          = var.app1 + "log/lighttpd.error.log"
    accesslog.filename       = var.app1 + "log/lighttpd.access.log"
    compress.cache-dir       = var.app1 + "tmp/cache"
}

var.app2 = "/usr/local/cart/jdonline/web/"
$SERVER["socket"] == "72.25.136.54:80" {
    server.name     = "domain2.com"
    server.error-handler-404 = "/dispatch.fcgi"
    server.document-root     = var.app2 + "public/"
    server.errorlog          = var.app2 + "log/lighttpd.error.log"
    accesslog.filename       = var.app2 + "log/lighttpd.access.log"
    compress.cache-dir       = var.app2 + "tmp/cache"
    fastcgi.server      = ( ".fcgi" => ( "localhost" => (
    "min-procs"       => 1,
    "max-procs"       => 1,
    "socket"          => var.app2 + "tmp/sockets/fcgi.socket",
    "bin-path"        => var.app2 + "public/dispatch.fcgi",
    "bin-environment" => ( "RAILS_ENV" => "development" )
) ) )
}


More information about the Mongrel-users mailing list