I have an nginx acting as a proxy in front of of a backend and I want to separate the requests made to a specific location to a separate file.
Still the requests should go to the same backend server but I don't want to see them inside the main access log.
Also I don't want to specify all the proxy_ stuff twice.
server {
...
access_log /var/log/nginx/jira.access.log full;
error_log /var/log/nginx/jira.error.log;
client_max_body_size 150m;
location /special/ {
}
location / {
# many lines of config params for proxy_...
proxy_pass http://dowa-02.example.com:8080;
...
}
}
UPD
Hmmm...
access_log
directive have a "feature".Requests are logged in a context of a location where processing ends. This may be different from the original location, if an internal redirect happens during request processing.
In case of
try_files
the internal redirect. Try changetry_files
toinclude
& remove named location.END OF UPD
In order not to repeat many times "proxy_ stuff", you can use
include
directive, for example. Buttry_files
and named location are much better :)