Opened 11 years ago

Closed 11 years ago

#389 closed defect (invalid)

nginx не понимает имя upstream из переменной

Reported by: Denis Shaposhnikov Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc:
uname -a: FreeBSD dsh.falconknight.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD dsh.falconknight.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD dsh.falconknight.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD dsh.falconknight.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
nginx -V: [dsh@dsh ~]% nginx -V
nginx version: nginx/1.5.2
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx-access.log --with-http_stub_status_module --with-pcre --with-http_spdy_module --with-http_ssl_module

Description

В переменной $sticky_backend находится значение "def_backend". Upstream с таким именем существует:

    upstream def_backend {
        server 127.0.0.1;
    }

При попытке использовать $sticky_backend в proxy_pass вот так:

            proxy_pass http://$sticky_backend:8080;

я получаю ошибку:

2013/07/31 11:52:07 [error] 58044#0: *1 no resolver defined to resolve def_backend, client: 88.103.18.63, server: dsh.perceptyx.com, request: "GET /demox/ HTTP/1.1", host: "dsh.perceptyx.com"

Change History (1)

comment:1 by Valentin V. Bartenev, 11 years ago

Resolution: invalid
Status: newclosed

Хотя upstream с именем def_backend и существует, но вот upstream-a с именем def_backend:8080 - нет.

Правильная конфигурация выглядит как-то так:

upstream def_backend {
    server 127.0.0.1:8080;
}

proxy_pass http://$sticky_backend;
Note: See TracTickets for help on using tickets.