我有一个为静态文件服务的nginx服务器,还有一个为其他文件服务的应用服务器。
要求的行为:
但是,目前,所有请求都被路由到最后一个块,并最终到达我的应用服务器。
发布于 2018-01-02 16:50:01
你的判断力似乎错了
server {
listen 8081;
location ~(.*)(endwithjs|endwithcss)$ {
return 301 https://www.perdu.com;
}
location ~^\/(startwithjs|startwithcss){
return 301 https://www.google.fr;
}
}Nginx将按以下方式处理请求:
http://localhost:8081/abc/abc/endwithjs => perdu.com
http://localhost:8081/startwithcss/Sdfsdf/sdf => google.fr
https://stackoverflow.com/questions/48062341
复制相似问题