NGinx - query count for a specific URL pattern

I wanted to count the number of requests for a specific url pattern. Not sure how to do this in NGinx.

Is it possible:

When a request for the url template appears, we first serve this request. Then NGinx makes asynchronously another request to the server, which takes into account the display. NGinx does not wait for a response to this request.

Thanks.

+4
source share
2 answers

You can use the post_action directive to run sub_request after the completion of the main request.

Useful for keeping a journal that you have in mind.

** OCT 2016 UPDATE **

The post_action directive has been removed from the Nginx documentation, and although it still works, use is not practical. Let the buyer be vigilant!

+4
source

You can try this module

https://github.com/theromis/ngx_counter_zone

very close to your request

+1
source

Source: https://habr.com/ru/post/1403103/


All Articles