![如何在 lighttpd 中正确永久重定向](https://linux22.com/image/793377/%E5%A6%82%E4%BD%95%E5%9C%A8%20lighttpd%20%E4%B8%AD%E6%AD%A3%E7%A1%AE%E6%B0%B8%E4%B9%85%E9%87%8D%E5%AE%9A%E5%90%91.png)
以下配置(/etc/lighttpd/lighttpd.conf
)似乎重定向到默认页面
$HTTP["host"] == "pool.ntp.org|ch.pool.ntp.org" {
accesslog.filename = "/var/log/lighttpd/pool.ntp.org_access.log"
$HTTP["url"] =~ "^/$" {
url.redirect = ( "" => "https://ntppool.org" )
url.redirect-code = 302
}
}
重定向此流量的正确方法是什么?
输入此信息并将pool.ntp.org指向此服务器的ip的hosts文件,结果是一个<h1>default</h1>
包含默认服务器内容的页面
答案1
多次发布。(请不要这样做,或者至少将它们链接到交叉引用!)
https://redmine.lighttpd.net/boards/2/topics/11458
$HTTP["host"] == "pool.ntp.org|ch.pool.ntp.org" {
应该是
$HTTP["host"] =~ "pool.ntp.org|ch.pool.ntp.org" {
因为看起来你想要一个正则表达式。
对于主机的精确匹配,我会使用更精确的正则表达式
$HTTP["host"] =~ "^(?:ch\.)?pool\.ntp\.org$" {
您可能已经使用以下方法自行解决了此问题 配置:调试变量
debug.log-condition-handling = "enable"
相关内容:如何将Http重定向到Https