On Wed, Apr 02, 2014 at 06:55:42PM +0530, Makailol C. wrote:
Hi,
Can some one provide me an example to set keep alive connection between
Nginx(reverse proxy) and backend server?
I can not use upstream module as my backend IP is dynamic based on
variable. So I can not use keepalive directive of upstream.
I have used below directive in location block.
proxy_pass http://$IP ;
Use of keepalive connections require upstream{} block to be
defined, see here for examples:
As long as list of backend ip addresses is limited, you may define
appropriate upstream{} blocks for each backend, and use upstream’s
name in a variable, e.g.:
Number of IPs are not fixed so it is not possible to define upstream and
map block I think. I am trying to implement completely dynamic
configuration using lua module.
Is it possible to use variable in upstream block like this?
upstream backend {
server $IP;
keepalive 2;
}