location ~* \.(...) access_log off; prevents access to files instead of logs

Roberto D. Maggi robertodmaggi at gmail.com
Tue Nov 14 13:51:05 UTC 2023


Hi you all,
I'm having a problem with these two stanzas, in writing down a virtual
host and can't figure out what's wrong with them.
They look correct but the first doesn't simply work and the second blocks

--> here I'm trying to add this header only to cgi|shtml|phtml|php 
extensions

location ~* \.(?:cgi|shtml|phtml|php)$ {
       add_header Cache-Control "public";
       client_max_body_size 0;
       chunked_transfer_encoding on;
       }

--> here I don't want to log accesses to to 
woff|woff2|ico|pdf|flv|jpg|jpeg|png|gif|js|css|gz|swf|txt files
location ~* 
\.(?:woff|woff2|ico|pdf|flv|jpg|jpeg|png|gif|js|css|gz|swf|txt)$ {
       access_log off;
       }


Does anybody can guess what's wrong with them?
Thanks in advance.

Rob


More information about the nginx mailing list