我使用的是在Amazon linux上安装了mod-wsgi的httpd2.4。
我的wsgi脚本如下所示:
/projects/mv2/test/test.wsgi
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from test import */projects/mv2/test/test.py
from flask import Flask
app = Flask(__name__)
@app.route('/test')
def hello_world():
return 'Hello, World!'Apache conf文件
<VirtualHost *:80>
ServerName test-algo.com
WSGIDaemonProcess algos_app user=mv2 group=mv2 threads=1
WSGIScriptAlias / /projects/mv2/test/test.wsgi
<Directory /projects/mv2/test/test>
WSGIProcessGroup algos_app
WSGIApplicationGroup %{GLOBAL}
Options MultiViews FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>当我点击url http://test-algo.com/test时,我得到一个403响应和下面的httpd error file
[authz_core:error] [pid 27555] [client 153.156.225.142:65083] AH01630: client denied by server configuration: /projects/mv2/test/test.wgi我找不到wsgi脚本的错误所在。
发布于 2016-08-29 17:41:33
Directory博客应该以以下内容开头:
<Directory /projects/mv2/test>在路径的末尾有一个额外的test。
这将导致403错误。
WSGI脚本还应该使用:
from test import app as applicationWSGI入口点的名称应该是application,而不是您的Flask文件使用的app。
如果不解决这个问题,在修复第一个错误后,您将得到一个不同的错误。
https://stackoverflow.com/questions/39200713
复制相似问题