Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个看起来像这样的位置块
location ~^ /foo/ { ... }
我收到一个对'/foo/bar'的请求,我怎么才能得到'bar'?
location ~ ^/foo/.*/?([^/]+)$ { set $doc $1; ... }
The above assumes you want the very last part if the request, below the foo path.
If you just want the second part:
location ~ ^/foo/(.*)$ { set $doc $1; }