NGINX load balancing - Proxy

Francis Daly francis at daoine.org
Tue Feb 15 16:47:01 UTC 2022


On Tue, Feb 15, 2022 at 12:31:06PM -0300, Carlos Renato wrote:

Hi there,

> This what I get when trying to start NGINX with the simplified file.
> 
> [root at proxy conf.d]# cat webgateway.conf
> upstream webgateway {
>    server 192.168.239.151:9090;
>    server 192.168.239.152:9090;
> }
> 
> server {
>    listen 9191;
>    proxy_pass webgateway;
>   }
> }

I suggest: remove or rename that webgateway.conf file, so that it will not
match whatever "include" line is already in your /etc/nginx/nginx.conf.

Then add those 10 lines to your /etc/nginx/nginx.conf, inside the
already-existing "stream{}" block; or create a new "stream{}" block
between the "events{}" block and the "http{}" block that are already in
your nginx.conf, and put those 10 lines inside that.


The reason is: when nginx runs, it reads one config file. That config
file might "include" some others. Typically, there is something like
"include /etc/nginx/conf.d/*.conf;" within the http{} block; but we do
not want to have this upstream-and-server config within http{}; it must
be within stream{}.

If your nginx binary does not include stream{}, then you probably want
to see about getting a new binary, if you want to use nginx to do the
thing that you want to do.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list