Answer the question
In order to leave comments, you need to log in
How to disable logging in nginx if the url contains a certain sequence of characters?
Good afternoon!
Help me to correctly compose the location to exclude entries from the error log if the url contains the @5h sequence.
The essence of the problem is that the site.com/a/b/*@5h*.png file, which does not exist on the server, is periodically requested. At the same time, an entry about this gets into error.log. It is necessary to correctly compose the location in order to disable logging.
Tried:
location ~* \@5h {
log_not_found off;
}
location ~* @5h {
location ~ @5h {
location ~ @5h* {
location ~* @5h* {
Answer the question
In order to leave comments, you need to log in
Does nginx's location check order exactly arrive at the correct location?
Also check if there are any prefix locations like this:
If the longest matching prefix location has the “^~” modifier then regular expressions are not checked.
Put deny all in the location to make sure it gets there. It seems to me that no.
Maybe @ should be urlencoded
@evnuh , @Nc_Soft , thanks for helping me solve the problem! Indeed, in front of the location I needed was one that did not allow me to reach the desired one.
After placement
location ~* \@5h {
log_not_found off;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question