【问题标题】:How do I set up a HTTP to HTTPS redirection for a specific domain in lighttpd?如何在 lighttpd 中为特定域设置 HTTP 到 HTTPS 重定向?
【发布时间】:2011-04-15 08:51:02
【问题描述】:

我想将特定域从 http 重定向到 lighttpd 中相应的 https 地址。我尝试了 lighttpd 页面上的教程,但它不是为特定域编写的。这就是我想要的:

$HTTP["host"] =~ "secure.example.com" {
     server.document-root = "/var/www/secure.example.com"
     // IF NOT SSL, REDIRECT TO SSL
}

感谢您的帮助。

【问题讨论】:

    标签: regex ssl redirect lighttpd


    【解决方案1】:

    您可以使用端口检测来确保您的用户来自 HTTP URL

    $SERVER["socket"] == ":80" {
      $HTTP["host"] =~ "example.org" {
        url.redirect = ( "^/(.*)" => "https://example.org/$1" )
        server.name                 = "example.org" 
      }
    }
    

    资源:

    【讨论】:

      猜你喜欢
      • 2013-11-05
      • 1970-01-01
      • 2016-02-28
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 2013-12-08
      相关资源
      最近更新 更多