lighttpd PHP Error: 403 - Forbidden

ⅰ亾dé卋堺 提交于 2019-12-12 16:12:20

问题


I have been trying to configure a web server using lighttpd on Windows. After installing PHP, everytime I try to access a PHP file from the directory 'htdocs,' I get the error: '403 - Forbidden.' I have followed this tutorial to setup lighttpd: http://joshdick.net/writing/lighttpd. I have searched Google, but haven't found any good documentation on this problem. FYI: I'm pretty new to this. I have the content of my 'lighttpd-inc.conf' file here.

Any help would be greatly appreciated. Thanks!


回答1:


There are a lot of things this could be. For instance, if you are using FastCGI on Windows there may be an issue (they don't play nice). It could be as simple as your folder permissions (in Windows) don't allow access to this folder. However, after trying to look over your .conf file (the lack of line breaks makes it a bear to read), I have a place you could start looking.

It looks like you are referring to the path to htdocs improperly. For example, this line here:

server.document-root = "HTDOCS/"

I don't think that path will work properly. Usually you have to have a "/HTDOCS/" style path. There are a number of lines like this throughout your file. Here is a link to some documentation on this:

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




回答2:


Your cgi/fcgi to your php is not configured correctly. CGI or FCGI is the glue that binds PHP and lighttpd together. check your lighttpd error.log it will state something like:

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

i use:

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"
                 )))   

make sure that fastcgi is enabled in modules.conf

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


来源:https://stackoverflow.com/questions/6246584/lighttpd-php-error-403-forbidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!