簡體   English   中英

lighttpd PHP 錯誤:403 - 禁止

[英]lighttpd PHP Error: 403 - Forbidden

我一直在嘗試使用 Windows 上的 lighttpd 配置 web 服務器。 安裝 PHP 后,每次我嘗試從目錄“htdocs”訪問 PHP 文件時,都會收到錯誤:“403 - 禁止訪問。” 我已按照本教程設置 lighttpd: http://joshdick.net/writing/lighttpd 我搜索了谷歌,但沒有找到關於這個問題的任何好的文檔。 僅供參考:我對此很陌生。 我在這里有我的“lighttpd-inc.conf”文件的內容。

任何幫助將不勝感激。 謝謝!

這可能是很多事情。 例如,如果您在 Windows 上使用 FastCGI,則可能會出現問題(它們玩得不好)。 它可能就像您的文件夾權限(在 Windows 中)不允許訪問此文件夾一樣簡單。 但是,在嘗試查看 your.conf 文件后(缺少換行符使其難以閱讀),我有一個可以開始查找的地方。

看起來您不正確地引用了 htdocs 的路徑。 例如,這里的這一行:

server.document-root = "HTDOCS/"

我認為這條路不會正常工作。 通常你必須有一個“/HTDOCS/”風格的路徑。 整個文件中有許多這樣的行。 以下是有關此內容的一些文檔的鏈接:

http://redmine.lighttpd.net/wiki/1/server.document-rootdetails

您的 php 的 cgi/fcgi 配置不正確。 CGI 或 FCGI 是將 PHP 和 lighttpd 粘合在一起的粘合劑。 檢查您的 lighttpd error.log 它將 state 類似於:

(mod_fastcgi.c.1397) [ERROR]: spawning fcgi failed. 

我用:

fastcgi.server = ( ".php" => ((                                      
                     "bin-path" => "/bin/php-cgi",             
                     "socket" => "/tmp/php.socket",              
                     "max-procs" => 1,                                     
                     "bin-environment" => (                         
                       "PHP_FCGI_CHILDREN" => "16",                    
                       "PHP_FCGI_MAX_REQUESTS" => "10000"           
                     ),         
                     "broken-scriptfilename" => "enable"
                 )))   

確保在 modules.conf 中啟用了 fastcgi

server.modules = (
  "mod_access",
  "mod_fastcgi",
#  "mod_alias",
#  "mod_auth",
#  "mod_evasive",
#  "mod_redirect",
#  "mod_rewrite",
#  "mod_setenv",
#  "mod_usertrack",
)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM