Opened 8 months ago

Last modified 8 months ago

#2315 closed defect

set environment in nginx configuration does not work — at Initial Version

Reported by: duttab49@… Owned by:
Priority: blocker Milestone:
Component: documentation Version: 1.19.x
Keywords: Cc:
uname -a: Linux ip-xxx-xx-xxx-xx.AWS_REGION.compute.internal 4.14.252-195.483.amzn2.x86_64 #1 SMP Mon Nov 1 20:58:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.20.0
built by gcc 7.3.1 20180712 (Red Hat 7.3.1-13) (GCC)
built with OpenSSL 1.1.1g FIPS 21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/ --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'



We have production deployment in AWS EKS where traffic from public Load balancer is routed to internal load balancer using nginx - using proxy_pass.
However, due to nginx caching of old load balancer IP addresses, nginx forward traffic to an IP address which does not exists as load balancer IP address is changed.
To address this issue, we have used following approach in ngixn configuration -

resolver valid=10s;

server {

location / {

set $backend_servers;
proxy_pass http://$backend_servers:8080;



But the above solution did not work. With set $env, nginx returns 404 error.

Please suggest.
We are seeing performance issue with Nginx caching the Load balancer IP address in production deployment. This is with nginx 1.20 running in AWS EC2 instance.

Change History (2)

by duttab49@…, 8 months ago

Attachment: user-config.txt added

user config files

by duttab49@…, 8 months ago

Attachment: nginx-defaul.conf added

default nginx config

Note: See TracTickets for help on using tickets.