101
¿En qué orden se activan las directivas de ubicación?Nginx location priority
¿En qué orden se activan las directivas de ubicación?Nginx location priority
Desde el HttpCoreModule docs:
Ejemplo de la documentación:
location =/{
# matches the query/only.
[ configuration A ]
}
location/{
# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
[ configuration B ]
}
location /documents/ {
# matches any query beginning with /documents/ and continues searching,
# so regular expressions will be checked. This will be matched only if
# regular expressions don't find a match.
[ configuration C ]
}
location ^~ /images/ {
# matches any query beginning with /images/ and halts searching,
# so regular expressions will not be checked.
[ configuration D ]
}
location ~* \.(gif|jpg|jpeg)$ {
# matches any request ending in gif, jpg, or jpeg. However, all
# requests to the /images/ directory will be handled by
# Configuration D.
[ configuration E ]
}
Si sigue siendo confuso, here's a longer explanation.
Dispara en este orden.
@brablc Gracias, fijo. –
con él puede ayudarle:) https://github.com/detailyang/nginx-location-match-visible – user2228392
Tenga en cuenta que las reglas '/' y '/ documents /' coinciden con la solicitud '/ documents/index.html' , pero esta última regla tiene prioridad ya que es la regla más larga. –