0
我在this question中發現誰將$ request_uri的第一個目錄映射到nginx變量。
我需要做的是白衣2個目錄和一個文件:本地主機:80/DIR1/DIR2/file.html地圖爲localhost:80/$ TOPDIR/$ secondir/$文件
我做的:
map $request_uri $topdir {
~(?<captured_topdir>[^\/]*[^\/]) $captured_topdir;
}
map $request_uri $secondir{
~([^\/]?<secondir>[^\/]) $secondir;
}
map $request_uri $endpart {
~([^\/]*[^\/]?<endpart>) $endpart;
}
但沒有運氣,當我在nginx上試用它時,只有$ topdir工作正常!
謝謝!