这是我第一次安装 lighttpd,配置 fcgi 时遇到了困难/var/www/站点/
我不断收到 403 Forbidden 并且到目前为止只找到特定于 php 或使用解决方法的指南。
让 fastcgi 在另一个文件夹上运行的正确方法是什么?
我的配置文件:
lighttpd.conf
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
#"mod_rewrite",
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
和10-fastcgi.conf
server.modules += ( "mod_fastcgi" )
快速 CGI 已成功启用并且服务器重新启动,我尝试了许多我发现的建议但都没有起作用,它们通常会导致服务器崩溃。
请原谅我的无知,并给我指明正确的方向。谢谢。
答案1
您需要确保php
并php-cgi
安装,然后将以下内容添加到您的lighttpd.conf
fastcgi.server = (
".php" => (( "bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",
"max-procs" => 2,
"bin-environment" => ( "PHP_FCGI_CHILDREN" => "10",
"PHP_FCGI_MAX_REQUESTS" => "10000" ),
"bin-copy-environment" => ( "PATH", "SHELL", "USER" ),
"broken-scriptfilename" => "enable" ))
)
添加完下面的内容后,重启lighttpd就可以正常工作了。你可以根据服务器资源增加进程和线程。