私はネットワークマシン上のポートに非常に単純なフラスコアプリを実行しようとしています。私の現在のサーバーのコードは次のようになります。特定のポートでmod_wsgiを使ってFlaskアプリを実行することはできますか?
from flask import Flask
import json
app = Flask(__name__)
@app.route('/my_route')
def my_route():
return json.dumps({'data': 'this is an example'})
私のネットワーク上のマシンのIPが123.123.123.123
だった、と私はポート5000
に私のアプリを実行したいと言います。私はブラウザでナビゲートするか、単純なHTTP
リクエストを123.123.123.123:5000/my_route
にしてJSON
という応答を得たいと考えています。
私はmod_wsgi Flask documentationに追って失敗しました。
Listen 5000
NameVirtualHost *:5000
<VirtualHost *:5000>
ServerName gcr_app
WSGIDaemonProcess gcr_app user=apache threads=5
WSGIScriptAlias//var/www/gcr_app/gcr_app.wsgi
<Directory /var/www/gcr_app>
WSGIProcessGroup gcr_app
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
をしてhttpd
サービスを再起動:私はこのようなディレクティブでhttpd.conf
を編集した後500 Internal Server
エラーが表示さになりました。
私はここで間違っていますか?その他の情報:
- RHEL 6.7
- のPython 3.4.4
- フラスコ0.12
Apacheのバージョン:
$ /usr/sbin/httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Feb 4 2016 08:22:15
私は提供することができ、他の有用な情報がありますなら、私を知ってみましょう。
エラーログ情報
[Mon Jan 30 17:55:22 2017] [error] [client x.x.x.x] (13)Permission denied: mod_wsgi (pid=2118): Unable to connect to WSGI daemon process 'gcr_app' on '/etc/httpd/logs/wsgi.2109.0.1.sock' after multiple attempts.
[Mon Jan 30 17:55:26 2017] [error] [client x.x.x.x] (13)Permission denied: mod_wsgi (pid=2114): Unable to connect to WSGI daemon process 'gcr_app' on '/etc/httpd/logs/wsgi.2109.0.1.sock' after multiple attempts.
[Mon Jan 30 17:55:27 2017] [error] [client x.x.x.x] (13)Permission denied: mod_wsgi (pid=2115): Unable to connect to WSGI daemon process 'gcr_app' on '/etc/httpd/logs/wsgi.2109.0.1.sock' after multiple attempts.
[Mon Jan 30 17:55:46 2017] [error] [client x.x.x.x] (13)Permission denied: mod_wsgi (pid=2113): Unable to connect to WSGI daemon process 'gcr_app' on '/etc/httpd/logs/wsgi.2109.0.1.sock' after multiple attempts.
[Mon Jan 30 17:57:48 2017] [error] [client x.x.x.x] File does not exist: /var/www/html/gcr_distance
[Mon Jan 30 17:57:48 2017] [error] [client x.x.x.x] File does not exist: /var/www/html/favicon.ico, referer: http://x.x.x.x/my_route
[Mon Jan 30 18:43:49 2017] [error] [client x.x.x.x] (13)Permission denied: mod_wsgi (pid=2116): Unable to connect to WSGI daemon process 'gcr_app' on '/etc/httpd/logs/wsgi.2109.0.1.sock' after multiple attempts.
おかげ
あなたは '/ var/log/httpd/*'に表示されているエラーを投稿するべきです –
それらを見て、何か重要なものがあるかどうかを確認してください –
Apache 2.2またはApache 2.4を実行していますか?あなたの設定は2.2で、RHEL 6と同じです。しかし、もしあなたがApache 2.4にアップグレードしたなら、パーミッションエラーを引き起こすかもしれない別の設定フォーマットがあります。 – FlipperPA