Nginx URL匹配

 

Nginx 下 location模块  可以实现对网页URL进行分析处理

location ~ .*.(gif|jpg|jpeg|png|bmg|swf)$ {
     //    扩展名为gif|jpg|jpeg|png|bmg|swf的静态文件都交给nginx处理;
root /nginx/web/www1;
expires  30d;
     //    expires 指定静态文件的过期时间 30天;
}

location ~ ^ /(upload|html|down)/ {
     //    设置将upload和HTML 目录下的所有文件都交给nginx处理了;upload 和html 目录都必须在 www1 下面;
root /nginx/web/www1;
expires  30d;
}

location ~ .*.jsp$ {
index index.jsp;
proxy_pass http:## //localhost:8088;
     //    对此虚拟机下的动态网页进行过滤处理,将所有的jsp为后缀的文件都交给本机的8088端口处理;
}
原文地址:https://www.cnblogs.com/sharesdk/p/7851631.html