lighttpd 限定 php 執行目錄

註解掉

cgi.assign                 = ( ".php"  => "/usr/local/bin/php-cgi", ".out" => "" )

啟用 "mod_alias" 並加入以下:

alias.url += ( "/p" => "/usr/local/php/" )
$HTTP["url"] =~ "^/p" {
cgi.assign                 = ( ".php"  => "/usr/local/bin/php-cgi", ".out" => "" )
}

上面這段意思是,將 /p 的路徑對應到 /usr/local/php/ 下,然後只有 http request url 是以 /p 開頭,才解譯 php。

非以 /p 開頭的 request 會回應 403 Forbidden

留言

熱門文章