如何使用 ssl 和代理设置 Lighttpd

How to setup Lighttpd with ssl and proxy

我正在尝试使用 ssl 和代理设置 Lighttpd,但我无法使其工作。 我已经安装了证书和私钥并且它们可以工作,但是当我尝试启用 ssl 时,端口 (443) 没有响应。

我的配置文件是 (conf-enabled/10-proxy.conf):

$HTTP["host"] == "host.com.br" {
        proxy.server = ( "" => ((
                "host" => "200.1.1.1",
                "port" => 9004
        )))
        ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/ssl/private_key.pem"
        ssl.ca-file = "/etc/lighttpd/ssl/certificate_file.crt"

}

我的lighttpd.conf是:

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
#       "mod_rewrite",
)

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

index-file.names            = ( "index.php", "index.html",
                                "index.htm", "default.htm",
                               " index.lighttpd.html" )

url.access-deny             = ( "~", ".inc" )

static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

include_shell "/usr/share/lighttpd/use-ipv6.pl"

dir-listing.encoding        = "utf-8"
server.dir-listing          = "enable"

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/x-javascript", "text/css", "text/html", "text/plain" )

include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

你需要告诉lighttpd监听443端口:

$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.pemfile = "/etc/lighttpd/ssl/private_key.pem"
    ssl.ca-file = "/etc/lighttpd/ssl/certificate_file.crt"
}

根据 docs 1.4.52 的 Lighttpd 不支持 SSL/TLS 和 mod_proxy。