我在访问“index.fcgi”时遇到问题;我不断收到 500 内部服务器错误。 这是我的错误日志:
[Thu Aug 09 19:40:17 2012] [warn] [client 127.0.0.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Aug 09 19:40:17 2012] [error] [client 127.0.0.1] Premature end of script headers: index.fcgi
这是我的 .htaccess 文件中的内容:
Options +ExecCGI
Options +Indexes
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/ [QSA,L]
这是我的index.fcgi:
#!/usr/bin/python2.7
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
print "Content-type: text/html\n\n"
print
print "<html>"
print "<body>"
print "<b>test</b>"
print "</body>"
print "</html>"
我什至删除了 django import 和 runfastcgi 组件,但我仍然无法看到我的页面。
为什么这种事会发生在我身上?我确实安装了 mod_python、mod_wsgi、mod_fcgid、mod_fcgi,但似乎没有任何东西可以使其运行...
最佳答案
有一个方法可以解决这个问题:cd到index.fcgi所在目录并运行./index.fcgi
- 这将为您提供确切的错误。
关于python - 如何在 Fedora 17 上将 FCGI 与 Python(和 Django)结合使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11894780/