我正在 lighttpd 上配置虚拟主机。由于某种原因,只有一个虚拟主机可以工作,而另一个不工作。这是配置:
#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")
}
我错过了什么?当它不起作用时,我只得到“它起作用了!”页面,而不是文件夹内容
答案1
嘿呀。。
尝试这个..
$HTTP["host"] =~ "^(www\.website\.com)$" {
server.document-root = "/var/www/astudio/sites/websiteTemp"
}
我猜你错过了克拉和括号(我认为它叫做克拉)
抱歉..我也没有看到..你可以避免这种情况,不要使用这样的正则表达式
$HTTP["host"] =~ "www.website.com" {
干杯