lighttpd 設定檔無法解析 $HTTP["url"] 條件配置,儘管其他設定檔可以運作

lighttpd 設定檔無法解析 $HTTP["url"] 條件配置,儘管其他設定檔可以運作

我正在嘗試為我的伺服器上特定路徑處的檔案設定 mimetypes,該伺服器正在運行帶有 SSL 的 lighttpd 版本 1.4.31。

我正在遵循此配置文件:http://redmine.lighttpd.net/projects/1/wiki/docs_configuration

直到 lighttpd 版本 1.5.0 才提供指定功能$PHYSICAL["path"],因此我嘗試指定$HTTP["url"].

我都嘗試過

$HTTP["url"] == '/my_path/directory_to_affect/foo.html' {
     # my settings are in here  
}

$HTTP["url"] =~ '/my_path/directory_to_affect/*' {
     # my settings are in here  
}

如果我使用lighttpd測試我的設定檔lighttpd -D -f lighttpd.conf或嘗試重新啟動lighttpd,我會收到此錯誤:

2015-04-29 14:37:52: (configfile.c.892) source: /etc/lighttpd/lighttpd.conf line: 48 pos: 12 invalid character in variable name 
2015-04-29 14:37:52: (configfile.c.948) configfile parser failed at: ==

或同樣的錯誤,但說=~而不是==.

讓我感到困惑的是,已經有其他條件配置,例如 where $SERVER["socket"] == ":80",而且這些配置運作得很好。

答案1

根據lighttpd 有關設定檔語法的文檔, 僅支援雙引號", 不'支援。

你的觀察,$SERVER["socket"] == ":80"有效,但$HTTP["url"] == '/my_path/'無效,證實了這一點。

相關內容