How to disable logging images in nginx but still allow the get request?
access-log, http, nginx
Solution
Put it in the server block and make sure that the "root" is correctly set up. It does work
Working example:
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires +60d;
access_log off;
}
I have this in the server block and not a location block.
Problem
I'm trying to log only java-script files request in the nginx access_log. I tried using the following code i found on this site: ``` location ~* ^.+.(jpg|jpeg|gif|css|png|html|htm|ico|xml|svg)$ { access_log off; } ``` the problem is it doesn't allow the get request at all and i get a 404 error when trying to run the html file that executes the js file in the browse. I want everything to work just the same but for the access log to log only request for js files. How do i do that?