如何將根目錄別名重新導向到lighttpd中的document_root子資料夾?

如何將根目錄別名重新導向到lighttpd中的document_root子資料夾?

我有這個目錄配置:

htdocs/www -> web site pages
htdocs/WEB-INF -> lib and classes, used in web pages
htdocs/data -> data (images, documents)

這就是我使用 apache 的方法:

htdocs/www/images/logo.gif
htdocs/www/exemple/php:
<?
include_once $_SERVER["DOCUMENT_ROOT"]."/lib/classes/A.class.php";
$s=file_get_contents($_SERVER["DOCUMENT_ROOT"]."/data/content.txt");
?>
<a href="/images/logo.gif">

這是我的 lighttpd conf 的一部分,模仿 Apache httpd.conf:alias.url = ("/" => ".../htdocs/www/") server.document-root = ".../htdocs"

不幸的是,$_SERVER["DOCUMENT_ROOT"] 指向 htdocs/www,而不是 htdocs。

如何修復它?

答案1

我認為你現在已經解決了這個問題,但如果沒有:

開啟/etc/lighttpd/lighttpd.conf並編輯指派給 的值{server.document-root}

您應該填寫完整路徑到您的網路根目錄。不要忘記重新啟動 lighttpd。

相關內容