Location container read order

I have one “location” container that servers static content:

location ~

and another “location” container that uses a backend apache server to
serve PHP file requests:

location / {

Are the “location” containers read in the order that they appear in the
configuration file? In the example above would the static location be
read before the proxy_pass container, insuring that the static content
“html” files would be served before a “php” file from the back proxy

I am trying to insure the proxy server does not serve php files that may
already exist as html files generated by WP Super Cache in Wordpress.

All the best,


Posted at Nginx Forum:

I went back and read all of
Module ngx_http_core_module. Thank you for
pointing me in the right direction.

The way I understand it is that if there are no regular expression
matches in the static location, then Nginx will use / in the proxy_pass
location for everything else, and in this case everything else would be
the php files.

Posted at Nginx Forum:


Nginx will use the location that matches the most specific. So any of
your locations should match before location / since that will be the
least general.