apache、ugswi、flask、通信问题
apache, ugswi, flask, problem with communication
我的小项目有问题。
我正在尝试在 apache 网络服务器上实现负载均衡器
谁会将所有传入请求发送到两个应用程序服务器
使用 uwsgi + flask。
My web serwer ip is: 10.0.0.10
App1: 10.0.0.8
App2: 10.0.0.9
当我遇到这样的情况时一切都很好:
app = Flask(__name__)
@app.route('/')
def index():
return render_template('heh.html')
然后我的url是10.0.0.10,显示heh.html的内容。所以这很好但是..
当我尝试路由到不同的位置时,我的问题开始了,例如:
@app.route('/project/')
def project():
return "I'm App 1"
当我尝试使用浏览器连接时:
10.0.0.10/项目
然后我的 url 更改为 10.0.0.8/projects 或 10.0.0.9/projects
我有 "Connection rejected"
的信息
我在以下 Web 服务器上的 Apache 配置:
<Proxy balancer://mycluster>
BalancerMember http://10.0.0.8:8081
BalancerMember http://10.0.0.9:8081
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
应用程序节点上的 Uwsgi 配置:
[uwsgi]
chdir = /opt/uwsgi
wsgi-file = myflaskapp.py
http-socket = :8081
processes = 20
threads = 10
stats = :8082
callable = app
uid = klopsiu
harakiri = 50
logto = /var/log/uwsgi/uwsgi.log
我的申请文件:
from flask import Flask, render_template, redirect, url_for, current_app
app = Flask(__name__)
@app.route('/')
def index():
return render_template('heh.html')
@app.route('/projects/')
def projects():
return "I'm app 1"
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
请指教。
我不想使用任何反向代理我希望一切都进出
通过负载均衡器。
感谢并等待您的帮助:)
那是我的错误,我忘记了当我尝试访问一些烧瓶时 url 我只需要在末尾添加 / ,例如:
10.0.0.10/数据库/
我的小项目有问题。 我正在尝试在 apache 网络服务器上实现负载均衡器 谁会将所有传入请求发送到两个应用程序服务器 使用 uwsgi + flask。
My web serwer ip is: 10.0.0.10
App1: 10.0.0.8
App2: 10.0.0.9
当我遇到这样的情况时一切都很好:
app = Flask(__name__)
@app.route('/')
def index():
return render_template('heh.html')
然后我的url是10.0.0.10,显示heh.html的内容。所以这很好但是..
当我尝试路由到不同的位置时,我的问题开始了,例如:
@app.route('/project/')
def project():
return "I'm App 1"
当我尝试使用浏览器连接时: 10.0.0.10/项目 然后我的 url 更改为 10.0.0.8/projects 或 10.0.0.9/projects 我有 "Connection rejected"
的信息我在以下 Web 服务器上的 Apache 配置:
<Proxy balancer://mycluster>
BalancerMember http://10.0.0.8:8081
BalancerMember http://10.0.0.9:8081
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/
应用程序节点上的 Uwsgi 配置:
[uwsgi]
chdir = /opt/uwsgi
wsgi-file = myflaskapp.py
http-socket = :8081
processes = 20
threads = 10
stats = :8082
callable = app
uid = klopsiu
harakiri = 50
logto = /var/log/uwsgi/uwsgi.log
我的申请文件:
from flask import Flask, render_template, redirect, url_for, current_app
app = Flask(__name__)
@app.route('/')
def index():
return render_template('heh.html')
@app.route('/projects/')
def projects():
return "I'm app 1"
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
请指教。 我不想使用任何反向代理我希望一切都进出 通过负载均衡器。
感谢并等待您的帮助:)
那是我的错误,我忘记了当我尝试访问一些烧瓶时 url 我只需要在末尾添加 / ,例如: 10.0.0.10/数据库/