
Nginx
根据URL带的参数转发的实现
本文介绍了根据URL的主要参数来完成Nginx的转发。原文根据示例代码非常详细,对大家的学习培训或者工作都有一定的参考价值。有必要的朋友陪我去了解一下。
应用场景:
必须根据提取的URL的动态性质提供自动跳转路径,这在内网浏览ip详细地址不固定的文件和图片时比较常见。
要求详细地址:http://11.19.1.212:82/bimg4/32.52.62.42:222/DownLoadFile?filename=LOC:12/data/20180208/15/2e0ae54dfd752210083404deed15269c_222403
所需地址:http://11.19.1.212:82/bimg4/32.52.62.42:222/DownLoadFile?filename=LOC:12/data/20180208/15/2e0ae54DFD752210083404deed15269c_222403
必须浏览的具体内网地址:http://32.52.62.42:222/DownLoadFile?filename=LOC:12/data/20180208/15/2e0ae54DFD752210083404deed15269c_222403
Nginx环境变量
server{
listen83;
server_namelocalhost;
indexindex.htmlindex.htm;
rootD:/workspace-xxxx/xxx_Web;
error_page500502503504/50x.html;
location=/50x.html{
roothtml;
}
location^~/xxx/{
proxy_passhttp://192.168.60.36:8090/xxxx/;
proxy_redirectdefault;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-Host$host;
proxy_set_headerX-Forwarded-Server$host;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
proxy_set_headerUpgrade$http_upgrade;
proxy_set_headerConnection"Upgrade";
}
#这里为提取要求详细地址中bimg4以后的途径,并赋给转发详细地址
location^~/bimg4/{
if($request_uri~/bimg4/(.*)){
set$bucketid$1;
}
proxy_passhttp://$bucketid;
}
}
到目前为止,这篇关于Nginx根据URLband的主要参数进行转发的文章已经在这里详细介绍过了。关于NginxURLband的大量转发内容,请搜索之前的文章或者再次访问下面的相关文章。期待你以后的申请!
评论列表(0条)