Using the construct mentioned in the docs for ssl http://trac.lighttpd.net/trac/wiki/HowToRedirectHttpToHttps
otherwise I get
"(network.c.300) can't bind to port: 80 Address already in use"
That works, as long as I don't use:
$HTTP["host"] == "example.com"
or
'$HTTP["host"] == "example.org"
anywhere else (eg. mod_auth or mod_cgi).
if so I get at lighty startup:
lighttpd: ./configparser.y:348: yy_reduce: Assertion
`yymsp[-3].minor.yy78->context_ndx < yymsp[0].minor.yy78->context_ndx' failed.
confs:
-------------------------------------------------------------------------------
10-ssl.conf:
$SERVER["socket"] == "0.0.0.0:443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/keys/example.com.pem"
ssl.ca-file = "/etc/lighttpd/keys/cacert.crt"
}
else $HTTP["host"] == "example.com" {
url.redirect = ( "^/(.*)" => "https://example.com/$1" )
}
else $HTTP["host"] == "example.org" {
url.redirect = ( "^/(.*)" => "https://example.org/$1" )
-------------------------------------------------------------------------------
lighttpd.conf
server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_rewrite",
"mod_redirect",
)
server.document-root = "/var/www/servers/example.com"
server.errorlog = "/var/log/lighttpd/error.log"
index-file.names = ( "index.php", "index.html",
accesslog.filename = "/var/log/lighttpd/access.log"
url.access-deny = ( "~", ".inc" )
server.port = 80
server.bind = "0.0.0.0"
server.pid-file = "/var/run/lighttpd.pid"
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"
server.username = "www-data"
server.groupname = "www-data"
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
-------------------------------------------------------------------------------
10-simple-vhost:
simple-vhost.server-root = "/var/www/servers/"
simple-vhost.document-root = "/pages/"
-------------------------------------------------------------------------------
I try to use e.g. 10-auth.conf
auth.require = ( "/postfix/admin/" =>
(
"method" => "basic",
"realm" => "no no noo",
"require" => "valid-user"
))
$HTTP["host"] == "example.com" {
auth.require = ( "/" =>
(
"method" => "basic",
"realm" => "no no noo",
"require" => "valid-user"
))
}
------------------------------------------------------------------------------
.. where the auth for postfix/admin works. but as soon as the
HTTP["host"] directive is in use lighty gives the above startup error.