Welcome! Log In Create A New Profile

Advanced

Ability to load balance from subfolders

Posted by truffle 
Ability to load balance from subfolders
April 13, 2016 07:51PM
Hello,
I would like to propose a simple feature request. The ability to use subfolders in the upstream module.

Rational:
1) I want to utilize several cheap and/or free FTP hosting sites.
2) Be able to load balance all of them using the same content across multiple hosts, even if in a shared hosting environment.

This should work like so:
-------------------------------------
http {
upstream myapp1 {
server srv1.example.com/path/to/user/dir/;
server srv2.example.com/path/to/another/user/dir/;
server srv3.example.com;
}

server {
listen 80;

location / {
proxy_pass http://myapp1;
}
}
}
------------------------

Currently srv1 and srv2 are not possible because having a path in the upstream module is invalid. If this were possible it opens up many affordable possibilities for load balancing.


Thanks for the consideration.
Re: Ability to load balance from subfolders
April 14, 2016 02:21AM
You can be setting the root for each backend to where ever you want, this is a backend setting, the frontend (nginx) should then only pass the relevant part which is the same (which it does anyway).

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Ability to load balance from subfolders
April 14, 2016 05:17PM
Not if you don't have root access to the server. e.g. 90% of shared hosting environments which don't allow subdomains.

Another example would be servers with Apache2 backend, since Nginx fails to follow .htacess / virtualhost redirects for subdomains under that scenario. (I tested this recently myself and ran into the unusual scenario of Apache VHost subdomains defaulting back to the root directory of a multisite install when used in combination with nginx load balancer. The apache2 subdomain site works properly by itself, in browsers, and etc. but had this unusual glitch of defaulting to the server root rather than the subdomain only when using as backend for nginx.)
Re: Ability to load balance from subfolders
April 15, 2016 02:14AM
Maybe use a local loop like;

proxy_pass pool1

pool1 {
backend1
backend2
}

server {
backend1
rewrite the URI for realbackend1
proxy_pass realbackend1
}

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 107
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready