2

Apache と Mysql の CentOS 6.6 で Flask アプリケーションを開発しています。The Flask Megatutorialから変更されています。通常どおりデータベースを作成できますが、ブラウザからアクセスしようとすると、500 内部サーバー エラーが発生し、error_log ファイルに次のように記録されます。

content type: text/html



<h1>Hello world!</h1>
[Sun May 03 18:39:53 2015] [error] [client my.ip.add.res] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun May 03 18:39:53 2015] [error] [client my.ip.add.res] Premature end of script headers: runp-mysql.fcgi

これは、runp-mysql.fcgi ファイルを次のように編集した後のものです。

#!flask/bin/python
#encoding=UTF-8
#import os

print "content type: text/html\n\n"
print ""
print "<h1>Hello world!</h1>"

これをコマンド ラインから実行すると、正しく完了します。

私の httpd.conf ファイルはこれで終わります:

FcgidIPCDir /tmp
AddHandler fcgid-script .fcgi
<VirtualHost *:80>
    DocumentRoot /home/apps/my_app/app/static
    Alias /static /home/apps/my_app/app/static
    ScriptAlias / /home/apps/my_app/runp-mysql.fcgi/
</VirtualHost>
4

2 に答える 2

0

これは私の実際の問題に基づいた非常に大まかな回答であり、他の誰かが同じチュートリアルに従っており、展開に問題がある場合にのみアップロードしています。その要点は、展開に使用した Python バージョン (2.7) では、フリップフロップ モジュールが機能せず、代わりに flup を使用する必要があったことです。同じエラーが発生した人は、試してみてください。うまくいくかもしれません。

于 2015-07-14T19:07:58.713 に答える