我正在尝试使用mod_wsgi设置烧瓶,但我一直收到以下错误
(13)Permission denied: access to / denied (filesystem path '/home/ec2-user/myapp') because search permissions are missing on a component of the path
test是烧瓶app中的有效路线.
这是我在/etc/httpd/conf.d文件夹中的myapp.conf文件
WSGIRestrictStdout Off
这是带有python 2.6.8的Apache / 2.2.26
我没有使用virtualenv.
当我启动apache时,我在error_log中看到这个通知
[Mon Feb 10 14:33:00 2014] [notice] Apache/2.2.26 (Unix) DAV/2 mod_wsgi/3.2 Python/2.6.8 configured -- resuming normal operations
这是我的myapp.wsgi文件
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
application.run(host='0.0.0.0',port=80)
只运行python myapp.wsgi工作正常
13PermissionDenied
的Apache文档,并确保为您的文件夹设置了正确的权限.
chmod 755 /home/ec2-user/myapp/
你也可以:
cd /home/ec2-user/
ls -la
这将输出每个文件和所有者:文件夹的每个用户组的组和权限.寻找与众不同的东西.
user=name | user=#uid.rst
Defines the UNIX user name or numeric user uid of the user that the daemon processes should be run as. If this option is not supplied the daemon processes will be run as the same user that Apache would run child processes and as defined by the User directive.
Note that this option is ignored if Apache wasn’t started as the root user,in which case no matter what the settings,the daemon processes will be run as the user that Apache was started as.
如果您以apache身份运行您的用户,它将不会以ec2-user身份运行,并且apache用户必须能够访问所有子目录和包含文件夹/ home / ec2-user /.
您可以移动到/ var / www /,chown到用户apache并从那里运行,因此您不必移动ec2-users主目录的权限.