任务是从查询参数获取参数的文件名,检查文件是否存在,以及:
我设法得到参数,并检查文件是否存在,但我不知道下一步该怎么做:
location /media/ { set $file "/static/$arg_key"; if (-f $file) { // Return the file } else { // include proxy_params; // proxy_pass http://unix:/opt/django/gunicorn.sock; } }
这是try_files的用途。
例如:
location /media/ { try_files /static/$arg_key @django; } location @django { proxy_whatever...; }