【问题标题】:How do I use FCGI with Python (and Django) on Fedora 17?如何在 Fedora 17 上将 FCGI 与 Python(和 Django)一起使用?
【发布时间】:2012-08-10 02:46:58
【问题描述】:

我无法访问我的“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,但似乎没有任何东西让它运行......

【问题讨论】:

    标签: python apache fedora fastcgi


    【解决方案1】:

    有一种方法可以解决这个问题:cd 到 index.fcgi 所在的目录并运行./index.fcgi
    - 这将为您提供确切的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-26
      • 1970-01-01
      • 1970-01-01
      • 2014-07-13
      • 2010-12-20
      • 1970-01-01
      • 2012-06-27
      • 2021-09-05
      相关资源
      最近更新 更多