Nginx: location regex for multiple paths

According to nginx documentation:

Then regular expressions are checked, in the order of their appearance
in the configuration file. The search of regular expressions
terminates on the first match, and the corresponding configuration is
used.

In your configuration, the following location is defined before the one with the proxy_pass and it matches the request of js and css files under static:

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
  }

Unfortunately the “log_not_found off” clause disables the logging for any file-not-found error related to this location, that’s why your error_log is empty!

You can try to comment out this location or move it after the location with the proxy_pass (if you need it for other files not in static / media).

Leave a Comment