nginx' try_files doesn't work with variables from location patte captures

خرید بک لینک

if i have a location directive with named captures:

location ~ ^/api/(?<endpoint>[^/]+)(?<pathinfo>.*) {
    root /opt/software/endpoints/;
    ## breaks the config:
    # try_files $document_root/$endpoint.php =404;
    include fastcgi_params; # as supplied by debian 8 "jessie"
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  $document_root/$endpoint.php;
}

without the try_files, calling the correct url does invoke the php-file and retus the output.

curl -s http://example.com/api/foo/param
> output of foo.php with param "param"

but when i also activate try_files in the config, the curl always retus 404.

(the reason is, that i want to specify an inteal redirect, in case no such endpoint exists, as last parameter to try_files. but i think =404 demonstrates the puzzlement better)

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 185 تاريخ: چهارشنبه 5 خرداد 1395 ساعت: 23:30

صفحه بندی