以下の簡単なファイル構成のflaskアプリをxserverのサーバー上で公開したところ500エラーが返ってきてしまいます。
こちら調べても原因が分からず困っております。良ければお知恵をお貸しいただけないでしょうか。
public_html/test/index.cgi(権限755)
1#!/usr/bin/python3 2# -*- coding: utf-8 -*- 3from wsgiref.handlers import CGIHandler 4from hello import app 5import os 6print("Content-type: text/html\n") 7os.environ["REQUEST_METHOD"] = "GET" 8CGIHandler().run(app)
public_html/test/htaccess(権限644)
1RewriteEngine On 2RewriteCond %{REQUEST_FILENAME} !-f 3RewriteRule ^(.*)$ /test/index.cgi/$1 [QSA,L]
public_html/test/hello.py(権限644)
1from flask import Flask 2 3app = Flask(__name__) 4 5@app.route('/') 6def hello_world(): 7 return 'Hello, World!'
以下のコマンドでpythonを実行したところstatus 200で'Hello, World!'が表示される為、python のpathも実行内容も間違ってないと思われます。
/usr/bin/python3 index.cgi
サーバー側のエラーログを見ると以下のようになっておりました。
[Sun Feb 06 18:37:49.557970 2022] [cgid:error] [pid 121509:tid 121581] [client 133.114.51.153:47578] End of script output before headers: index.cgi

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。