[英]Use multiple Heroku apps for load balancing Nginx
I need to design one system requiring: 我需要设计一个系统,要求:
1 Node.js Server is used for reversed proxy for load balancing by using Nginx. 1 Node.js Server通过使用Nginx用于反向代理以实现负载平衡。
4 Node.js Server is used for RESTful APIs. 4 Node.js Server用于RESTful API。 All of them need to be connected to the server above.
所有这些都需要连接到上面的服务器。
I found out that no solution for specifying in case of using multiple heroku apps for load balancing. 我发现在使用多个heroku应用程序进行负载平衡时没有指定解决方案。 What should I configure
nginx.conf.erb
file in the first server to connect 4 Heroku server in the right way? 我应该在第一台服务器中配置
nginx.conf.erb
文件以正确的方式连接4个Heroku服务器? I try implementing like this link http://nginx.org/en/docs/http/load_balancing.html but I just only receive 400 base request
. 我尝试实现这个链接http://nginx.org/en/docs/http/load_balancing.html,但我只收到
400 base request
。
Heroku Round-Robin Load Balancing Heroku Round-Robin负载平衡
server {
listen 80 default_server;
server_name _;
location / {
set_formatted_local_time $upstream "%S";
if ($upstream ~ 00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15) {
set $backend_url http://phpmyadmin-heroku.herokuapp.com;
set $backend_host phpmyadmin-heroku.herokuapp.com;
}
if ($upstream ~ 16|17|18|19|20|21|22|23|24|25|26|27|28|29|30) {
set $backend_url https://helloenvoy.herokuapp.com;
set $backend_host helloenvoy.herokuapp.com;
}
if ($upstream ~ 31|32|33|34|35|36|37|38|39|40|41|42|43|44|45) {
set $backend_url http://powr.herokuapp.com;
set $backend_host powr.herokuapp.com;
}
if ($upstream ~ 46|47|48|49|50|51|52|53|54|55|56|57|58|59) {
set $backend_url https://blog.heroku.com;
set $backend_host blog.heroku.com;
}
proxy_pass $backend_url;
proxy_set_header Host $backend_host;
}
location /load_balancing_heroku_resolver1 {
proxy_pass http://phpmyadmin-heroku.herokuapp.com;
}
location /load_balancing_heroku_resolver2 {
proxy_pass https://helloenvoy.herokuapp.com;
}
location /load_balancing_heroku_resolver3 {
proxy_pass http://powr.herokuapp.com;
}
location /load_balancing_heroku_resolver4 {
proxy_pass https://blog.heroku.com;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.