APTX Blog

A Moe Blog Set Up By APTX

Lighttpd:配置SSL并强制跳转https配置

文章目录[隐藏]

简介

很长时间之前写过小内存安装Wordpress的文章:https://www.cokemine.com/64mb-vps-wp.html,这里使用的Lighttpd,为了让它更有B格,我们也可以给它装上SSL

配置

$SERVER["socket"] == ":443" {
    ssl.engine = "enable" 
    ssl.pemfile = "/etc/lighttpd/ssl/kms.pem" 
    $HTTP["host"] =~ "kms.aptx.xin" {
	server.document-root = "/home/wwwroot/kms/public"
	accesslog.filename = "/var/log/lighttpd/kms/access.log"
	server.error-handler-404 = "/404.html"
}
}
$HTTP["scheme"] == "http" {
    # capture vhost name with regex conditiona -> %0 in redirect pattern
    # must be the most inner block to the redirect rule
    $HTTP["host"] =~ ".*" {
        url.redirect = (".*" => "https://%0$0")
    }
}
点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注