I need to design one system requiring:
1 Node.js Server is used for reversed proxy for load balancing by using Nginx.
4 Node.js Server is used for RESTful APIs. 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. What should I configure nginx.conf.erb
file in the first server to connect 4 Heroku server in the right way? I try implementing like this link http://nginx.org/en/docs/http/load_balancing.html but I just only receive 400 base request
.
Heroku Round-Robin Load Balancing
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;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.