Logging of accesses to a specific url

The challenge is to write access.log for specific references. Set it in a separate location — not working.

location ^~ /blabla/ {
access_log /var/log/nginx/blabla_access.log;
root /etc/nginx/html/blabla;
try_files $uri @app;


Then I read somewhere that the log is written after all of the handlers, then you have to write in @app. Kopipastom @app in @app1, tried method — still not working.

location @app1 {
access_log /var/log/nginx/blabla_access.log;
access_log on;
"limit_req" zone=anticlick burst=5;
proxy_pass 127.0.0.1:8080;
proxy_buffering on;
proxy_buffer_size 256k;
proxy_buffers 16 256k;
proxy_busy_buffers_size 512k;
"proxy_redirect" off;
"proxy_next_upstream" error timeout;
proxy_temp_path /var/tmp/nginx/tmp;
proxy_set_headerHost $host;
proxy_set_headerX-Real-IP "$remote_addr";
proxy_set_headerReferer>"$http_referer";
proxy_set_headerUser-Agent "$http_user_agent";
proxy_set_headerX-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_headerHTTP_X_FORWARDED_for "$proxy_add_x_forwarded_for";
proxy_intercept_errors on;
October 3rd 19 at 03:30
1 answer
October 3rd 19 at 03:32
Solution
Itself asked — itself answered.

The only working option was this one:

location ^~ /blabla{
access_log /var/log/nginx/blabla_access.log;
error_log /var/log/nginx/blabla_error.log;
root /etc/nginx/html/blabla;

proxy_passhttp://127.0.0.1:8080/blabla;
proxy_buffering on;
proxy_buffer_size 256k;
proxy_buffers 16 256k;
proxy_busy_buffers_size 512k;
"proxy_redirect" off;
"proxy_next_upstream" error timeout;
proxy_temp_path /var/tmp/nginx/tmp;
proxy_set_headerHost $host;
proxy_set_headerX-Real-IP "$remote_addr";
proxy_set_headerReferer "$http_referer";
proxy_set_headerUser-Agent "$http_user_agent";
proxy_set_headerX-Forwarded-For "$proxy_add_x_forwarded_for";
proxy_set_headerHTTP_X_FORWARDED_for "$proxy_add_x_forwarded_for";
proxy_intercept_errors on;
}

Find more questions by tags Nginx