Lighttpd

Lighttpd 中的虛擬主機不起作用

  • November 7, 2010

我在 lighttpd 上配置虛擬主機。出於某種原因,只有 1 個虛擬主機可以工作,而另一個不能。這是配置:

#this doesn't work (just a html file)
$HTTP["host"] =~ "^www\.website\.com$" {
 server.document-root = "/var/www/astudio/sites/websiteTemp"
}

#this works (Drupal installation)
$HTTP["host"] =~ "beta\.website\.com" {
 server.document-root = "/var/www/astudio/sites/website"
 server.errorlog = "/var/log/lighttpd/danydiop/error.log"
 accesslog.filename = "/var/log/lighttpd/danydiop/access.log"
 include_shell "./drupal-lua-conf.sh danydiop"

url.access-deny += ( "~", ".inc", ".engine", ".install", ".info",
      ".module", ".sh", "sql", ".theme",
      ".tpl.php", ".xtmpl", "Entries",
      "Repository", "Root" )


 # "Fix" for Drupal SA-2006-006, requires lighttpd 1.4.13 or above
 # Only serve .php files of the drupal base directory
 $HTTP["url"] =~ "^/.*/.*\.php$" {
     fastcgi.server = ()
     url.access-deny = ("")
 }

 magnet.attract-physical-path-to = ("/etc/lighttpd/drupal-lua-scripts/p-.lua")

}

我錯過了什麼?當它不起作用時,我只會看到“It Works!”頁面。而不是文件夾內容

乾草那裡..

試試這個..

$HTTP["host"] =~ "^(www\.website\.com)$" {
 server.document-root = "/var/www/astudio/sites/websiteTemp"
}

我猜你錯過了克拉和括號(我認為它叫做克拉)

對不起..我也沒有看到..你總是可以通過不使用這樣的正則表達式來避免這種情況

$HTTP["host"] =~ "www.website.com" {

乾杯

引用自:https://serverfault.com/questions/199153