Hi, Josef This what I get when trying to start NGINX with the simplified file.
[root@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; } } [root@proxy conf.d]# nginx -t nginx: [emerg] "proxy_pass" directive is not allowed here in /etc/nginx/conf.d/webgateway.conf:8 nginx: configuration file /etc/nginx/nginx.conf test failed [root@proxy conf.d]# systemctl status nginx ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2022-02-15 02:38:56 -03; 39s ago Process: 14415 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 14700 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) Process: 14699 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 14417 (code=exited, status=0/SUCCESS) Feb 15 02:38:56 proxy.lab.local systemd[1]: Starting The nginx HTTP and reverse proxy server... Feb 15 02:38:56 proxy.lab.local nginx[14700]: nginx: [emerg] "proxy_pass" directive is not allowed here in /etc/nginx/conf.d/webgateway.conf:8 Feb 15 02:38:56 proxy.lab.local nginx[14700]: nginx: configuration file /etc/nginx/nginx.conf test failed Feb 15 02:38:56 proxy.lab.local systemd[1]: nginx.service: control process exited, code=exited status=1 Feb 15 02:38:56 proxy.lab.local systemd[1]: Failed to start The nginx HTTP and reverse proxy server. Feb 15 02:38:56 proxy.lab.local systemd[1]: Unit nginx.service entered failed state. Feb 15 02:38:56 proxy.lab.local systemd[1]: nginx.service failed. [root@proxy conf.d]# Thank You! Em ter., 15 de fev. de 2022 às 12:25, Josef Vybíhal <josef.vybi...@gmail.com> escreveu: > Seems to me, that you are not using stream{} module as noted by > Francis, and you are still putting server block to http{}. If not, > post nginx -T > J. > > On Tue, Feb 15, 2022 at 4:17 PM Carlos Renato <crenat...@gmail.com> wrote: > > > > Hi Francis, > > Thanks for the reply and willingness to help me. > > > > [root@proxy conf.d]# cat teste.conf > > upstream webgateway { > > server 192.168.239.151:9090; > > server 192.168.239.152:9090; > > } > > > > server { > > listen 9191; > > proxy_pass webgateway; > > } > > [root@proxy conf.d]# > > > > I cannot start NGINX. > > > > Feb 15 01:56:24 proxy.lab.local systemd[1]: Starting The nginx HTTP and > reverse proxy server... > > Feb 15 01:56:24 proxy.lab.local nginx[12274]: nginx: [emerg] > "proxy_pass" directive is not allowed here in /etc/nginx/conf.d/teste.conf:8 > > Feb 15 01:56:24 proxy.lab.local nginx[12274]: nginx: configuration file > /etc/nginx/nginx.conf test failed > > Feb 15 01:56:24 proxy.lab.local systemd[1]: nginx.service: control > process exited, code=exited status=1 > > Feb 15 01:56:24 proxy.lab.local systemd[1]: Failed to start The nginx > HTTP and reverse proxy server. > > Feb 15 01:56:24 proxy.lab.local systemd[1]: Unit nginx.service entered > failed state. > > Feb 15 01:56:24 proxy.lab.local systemd[1]: nginx.service failed. > > > > I can only start NGINX if the file is as below. > > > > upstream webgateway { > > server 192.168.239.151:9090; > > server 192.168.239.152:9090; > > } > > > > server { > > listen 9191; > > > > location / { > > proxy_set_header Host $host; > > proxy_set_header X-Real-IP $remote_addr; > > proxy_pass http://webgateway; > > } > > } > > > > The behavior on the client is the same. > > I can load HTTP page and cannot HTTPS. On the Web Gateway, I view the > access logs with the client's IP. > > > > In tests, I noticed that the "http_pass" below the "listen", I can't > start NGINX. > > I had to also put it as "http" or http://webgateway; > > > > If you don't put the parameters below, the proxy tries to load the page > http://webgateway. > > proxy_set_header Host $host; > > > > The parameter below registers the IP-Real of the client in the proxy. > > proxy_set_header X-Real-IP $remote_addr; > > > > Any tips? Thank You. > > > > > > > > Em ter., 15 de fev. de 2022 às 11:16, Francis Daly <fran...@daoine.org> > escreveu: > >> > >> On Tue, Feb 15, 2022 at 10:29:50AM -0300, Carlos Renato wrote: > >> > >> Hi there, > >> > >> > My file is like this. > >> > >> Untested by me, but I have edited this to now resemble what I think > >> you want... > >> > >> > upstream webgateway { > >> > server 192.168.239.151:9090; > >> > server 192.168.239.152:9090; > >> > } > >> > > >> > server { > >> > listen 9191; > >> > proxy_pass webgateway; > >> > } > >> > >> ...that is, keep your upstream{} but remove the keepalive; adjust your > >> server{} to just have "listen" and a different "proxy_pass"; and put > >> the whole thing inside "stream{}" not "http{}". > >> > >> > I'm able to open HTTP requests in the client's browser. > >> > The problem is being the HTTPS requests. > >> > Is there any way for NGINX to receive the traffic and forward it > (balanced) > >> > to the proxy servers? > >> > A simpler way. That way I could include the Web Gateway certificate > in the > >> > Windows client. > >> > >> If I have understood correctly what you are trying to do, the notes at > >> > https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/ > >> look relevant. That expands on what is at > >> http://nginx.org/en/docs/stream/ngx_stream_core_module.html. > >> > >> Cheers, > >> > >> f > >> -- > >> Francis Daly fran...@daoine.org > >> _______________________________________________ > >> nginx mailing list -- nginx@nginx.org > >> To unsubscribe send an email to nginx-le...@nginx.org > > > > > > > > -- > > > > > > _______________________________________________ > > nginx mailing list -- nginx@nginx.org > > To unsubscribe send an email to nginx-le...@nginx.org > _______________________________________________ > nginx mailing list -- nginx@nginx.org > To unsubscribe send an email to nginx-le...@nginx.org > --
_______________________________________________ nginx mailing list -- nginx@nginx.org To unsubscribe send an email to nginx-le...@nginx.org