![为什么 lighttpd 和 fastcgi 一直向我发送 *.scgi 文件而不是网站内容?](https://linux22.com/image/534481/%E4%B8%BA%E4%BB%80%E4%B9%88%20lighttpd%20%E5%92%8C%20fastcgi%20%E4%B8%80%E7%9B%B4%E5%90%91%E6%88%91%E5%8F%91%E9%80%81%20*.scgi%20%E6%96%87%E4%BB%B6%E8%80%8C%E4%B8%8D%E6%98%AF%E7%BD%91%E7%AB%99%E5%86%85%E5%AE%B9%EF%BC%9F.png)
我有以下配置:
server.modules = (
"mod_compress",
"mod_access",
"mod_alias",
"mod_rewrite",
"mod_redirect",
"mod_secdownload",
"mod_h264_streaming",
"mod_flv_streaming",
"mod_accesslog",
"mod_auth",
"mod_status",
"mod_expire",
"mod_fastcgi"
)
[...]
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/tmp/lighttpd/php-fastcgi.socket" + var.PID,
"max-procs" => 1,
"kill-signal" => 9,
"idle-timeout" => 10,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "200",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"/pyapps/essai/blondes.fcgi" => (
"main" => (
"socket" => "/var/tmp/lighttpd/django-fastcgi.socket",
),
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
)))
[...]
$HTTP["host"] =~ "(^|www\.)cam\.com(\:[0-9]*)?$" {
server.document-root = "/home/cam/web/"
accesslog.filename = "/home/cam/log/access.log"
server.errorlog = "/home/cam/log/error.log"
server.follow-symlink = "enable"
# files to check for if .../ is requested
server.indexfiles = ( "index.php", "index.html", "index.htm", "index.rb")
url.rewrite = (
"^(/blondes/.*)$" => "/pyapps/essai/blondes.fcgi$1"
)
}
我有以下目录树:
/home/tv/web/
`-- pyapps
`-- essai
`-- __init__.py
`-- blondes.fcgi
`-- blondes.pid
`-- django-fcgi.py
`-- manage.py
`-- manage.pyo
`-- plop
`-- settings.py
`-- urls.py
重新启动lighthttpd时没有错误。
我运行:
./manage.py runfcgi method=prefork socket=/var/tmp/lighttpd/django-fastcgi.socket daemonize=false pidfile=blondes.pid
也没有错误。
我建议我下载一个空文件。
我检查了权限但所有内容都设置为相同的用户和组,并且它们适用于 PHP 网站。
文件 /var/tmp/lighttpd/django-fastcgi.socket 存在。
当我重新加载页面时,错误日志中没有输出,manage.py runfcgi 命令中也没有输出。
我可能忽略了一些显而易见的东西,但是什么呢?
答案1
找到了。
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/tmp/lighttpd/php-fastcgi.socket" + var.PID,
"max-procs" => 1,
"kill-signal" => 9,
"idle-timeout" => 10,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "200",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"/pyapps/essai/blondes.fcgi" => (
"main" => (
"socket" => "/var/tmp/lighttpd/django-fastcgi.socket",
),
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
)))
应该:
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/tmp/lighttpd/php-fastcgi.socket" + var.PID,
"max-procs" => 1,
"kill-signal" => 9,
"idle-timeout" => 10,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "200",
"PHP_FCGI_MAX_REQUESTS" => "1000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
)),
"/pyapps/essai/blondes.fcgi" => (
"main" => (
"socket" => "/var/tmp/lighttpd/django-fastcgi.socket",
),
),
)
只是一个愚蠢的语法错误。当传递无用的参数时,Lightttpd 不会告诉您任何信息。没有错误消息。什么都没有。