Great question! A useful benefit of nested locations is for the ability for the outer configuration to be inherited by the inner, nested locations. Typically we use the server{} block to set directives that will be inherited by each location but that can fall down when we have a lot of different apps/APIs handled by the same server{}.
So there is a functional difference between A and B. In config A, /nested-location inherits all of the configuration a directives as well as the explicit configuration b directives.
Here’s a more explicit example of when that might be useful. All our API requests go to the same place, but the auth token varies between v1 and v2. Once you have 10-20 directives defined for /api/ having to repeat yourself just for one exception becomes a burden and error-prone.
I will briefly add to this that there are some exceptions to these inheritance rules such as the add_header directive, but these are always documented in our docs
Thank you for your answer. This cleared up my understanding of nested locations.
In my real-world application, I will move forward with config A since there are 5 directives that I would like to have inherit the configuration from the top-level location.