Opened 7 years ago

Closed 7 years ago

#1356 closed defect (invalid)

try_files directive and variables

Reported by: BUsy Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc:
uname -a: FreeBSD wordpress 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
nginx -V: nginx version: nginx/1.12.1
built with OpenSSL 1.0.2l 25 May 2017
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 --modules-path=/usr/local/libexec/nginx --with-google_perftools_module --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 --add-module=/wrkdirs/usr/ports/www/nginx/work/nginx_accept_language_module-2f69842 --with-http_addition_module --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/nginx-auth-ldap-dbcef31 --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/ngx_http_auth_pam_module-1.5.1 --add-module=/wrkdirs/usr/ports/www/nginx/work/ngx_cache_purge-2.3 --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/headers-more-nginx-module-84241e4 --with-http_dav_module --add-module=/wrkdirs/usr/ports/www/nginx/work/nginx-dav-ext-module-0.0.3 --add-module=/wrkdirs/usr/ports/www/nginx/work/nginx-http-footer-filter-1.2.2 --with-http_geoip_module=dynamic --with-http_gzip_static_module --with-http_gunzip_module --with-http_image_filter_module=dynamic --add-module=/wrkdirs/usr/ports/www/nginx/work/nginx-notice-3c95966 --with-http_perl_module=dynamic --with-http_realip_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_xslt_module=dynamic --add-module=/wrkdirs/usr/ports/www/nginx/work/ngx_devel_kit-0.3.0 --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/memc-nginx-module-0.18 --with-pcre --add-module=/wrkdirs/usr/ports/www/nginx/work/xss-nginx-module-0.05 --with-http_v2_module --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-http_ssl_module --add-module=/wrkdirs/usr/ports/www/nginx/work/iconv-nginx-module-0.14

Description

Maybe I am wrong or this is only a documentation level problem but I can easily replicate issue below on multiple servers:

    location / {
        set $tryme "$uri/";
#        try_files $uri $uri/ /index.php?$is_args$args;
        try_files $uri $tryme /index.php?$is_args$args;
    }

Variable $tryme does not work in this setup.

Change History (1)

comment:1 by Roman Arutyunyan, 7 years ago

Resolution: invalid
Status: newclosed

If your intention was to check $uri/ directory existence, you should have ended the try_files argument with the explicit "/". Putting slash at the end of a variable value does not work here. You may still use the variables in this argument, but the last argument symbol must be the explicit slash.

Note: See TracTickets for help on using tickets.