【发布时间】:2016-12-09 21:37:01
【问题描述】:
我正在运行一个 Amazon EC2 微型实例,我想使用 Flask 从它运行一个 python 应用程序。
这是我的app.py 文件,我正在其中进行简单的文件上传(在localhost:5000 上工作正常):
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello from Flask!'
if __name__ == '__main__':
app.run()
这是我的文件,名为 adapter.wsgi,用于将其连接到 apache:
import sys
sys.path.insert(0, '/var/www/html/lumos')
from app import app as application
最后,在我的httpd.conf 文件中,我做了以下事情:
<VirtualHost *>
ServerName http://lumos.website.me
DocumentRoot /var/www/html/lumos
WSGIDaemonProcess lumos threads=5
WSGIScriptAlias / /var/www/html/lumos/adapter.wsgi
<Directory "/var/www/html/lumos">
WSGIProcessGroup lumos
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
然后当我重新启动 apache 服务器并转到 http://lumos.website.me/ 时,我得到的只是 503:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.31 (Amazon) Server at lumos.website.me Port 80
关于如何让烧瓶应用程序在 apache 服务器上运行有什么想法吗?
注意:我的服务器正在运行。
更新:
这是我的错误日志文件
[Thu Aug 04 01:34:09 2016] [notice] caught SIGTERM, shutting down
[Thu Aug 04 01:34:09 2016] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Aug 04 01:34:09 2016] [notice] Digest: generating secret for digest authentication ...
[Thu Aug 04 01:34:09 2016] [notice] Digest: done
[Thu Aug 04 01:34:10 2016] [notice] Apache/2.2.31 (Unix) DAV/2 PHP/5.3.29 mod_wsgi/3.2 Python/2.6.9 configured -- resuming normal operations
[Thu Aug 04 01:34:14 2016] [error] [client 72.219.147.5] (13)Permission denied: mod_wsgi (pid=30315): Unable to connect to WSGI daemon process 'lumos' on '/etc/httpd/logs/wsgi.30311.0.1.sock' after multiple attempts.
[Thu Aug 04 01:34:14 2016] [error] [client 72.219.147.5] (13)Permission denied: mod_wsgi (pid=30316): Unable to connect to WSGI daemon process 'lumos' on '/etc/httpd/logs/wsgi.30311.0.1.sock' after multiple attempts., referer: http://lumos.website.me/
[Thu Aug 04 01:34:15 2016] [error] [client 72.219.147.5] (13)Permission denied: mod_wsgi (pid=30317): Unable to connect to WSGI daemon process 'lumos' on '/etc/httpd/logs/wsgi.30311.0.1.sock' after multiple attempts.
【问题讨论】:
-
你的服务器在运行吗?
-
是的,我已经在我的问题中更新了它
-
把这个添加到你的httpd文件下面 "
MaxConnPerVhost 100 " 然后重启Apache看看它是否有效? -
检查 apache 错误日志,如果需要增加日志级别。
-
@error2007s 我收到语法错误
<IfModule takes one argument, Container for directives based on existance of specified modules
标签: python apache amazon-web-services amazon-ec2 flask