首页 > 解决方案 > 如何从 nginx 中的文件映射/重写多个源和目标 URL?

问题描述

档案ABC

sample/xyz/xyz/ should map to /abc/abc/
sample/foo/foo/ should map to /bar/bar/

nginx.conf

include ABC

location sample/ {
   local url = ngx.var.uri #(uri = sample/xyz/xyz/)

   ######## Do something here so that variable url value is changed based on the value in File ABC########

   url = /abc/abc/ #(change URI after lookup from file ABC)
}

标签: nginxnginx-locationnginx-config

解决方案


推荐阅读