zoukankan      html  css  js  c++  java
  • [日常] 前端资源测试机上忽略版本号的的nginx配置

    利用nginx的rewrite的指令,可以实现url的重新跳转,rewrtie有四种不同的flag,分别是redirect(临时重定向)、permanent(永久重定向)、break和last。其中前两种是跳转型的flag,后两种是代理型,跳转型是指有客户端浏览器重新对新地址进行请求,代理型是在WEB服务器内部实现跳转的

    redirect #临时重定向,重写完成后以临时重定向方式直接返回重写后生成的新URL给客户端,有客户端重新发起请求,使用相对路径,http://或https://开头,状态码:302
    permanent #永久重定向,以永久重定向的方式直接返回重写后生成的新URL给客户端,由客户端重新发起新的请求,状态码:301
    last #重写完成后停止对当前location中后续的其他重写操作,而后对新的URL启动新一轮重写检查,不建议在location中使用
    break #重写完成后停止对当前URL在当前location中后续的其他重写操作,而后直接跳转至重写规则匹配块之后的其他配置;结束循环,建议在location中使用

    server {
            listen       80;
            server_name  n.sinaimg.cn 2008mail.sina.com.cn www.sinaimg.cn ;
    
            root         /usr/local/sinaria;
            rewrite ^/mail/sinamail66/js/d+/(.*)$ /sinamail66/js/$1 last;
            rewrite ^/mail/sinamail66/css/d+/(.*)$ /sinamail66/css/$1 last;
            rewrite ^/mail/sinamail66/images/d+/(.*)$ /images/$1 last;
            rewrite ^/mail/sinamail66/skins/d+/(.*)$ /skins/$1 last;
            rewrite ^/mail/sinamail/js/d+/(.*)$ /mail/$1 last;
            rewrite ^/rny/webface/conf/d+/(.*)$ /webface/conf/$1 last;
            rewrite ^/rny/sinamail66/skins/d+/(.*)$ /sinamail66/skins/min/$1 last;
            rewrite ^/rny/sinamail57/images/d+/(.*)$ /images/$1 last;
            rewrite ^/js/(.*)$ /js/$1 last;
        location / {
        }
    
    }
  • 相关阅读:
    IOS开发--常用的基本GDB命令
    iOS 开发技巧-制作环形进度条
    提高Objective-C代码质量心机一:简化写法
    iOS 删除 Main.storyboard 和 LaunchScreen.storyboard
    iOS扫一扫功能开发
    ASP.NET中Json的处理
    WebService的使用
    嵌入Web资源的方法
    URL重写 UrlRewrite
    ASP.NET全局文件与防盗链
  • 原文地址:https://www.cnblogs.com/taoshihan/p/11900573.html
Copyright © 2011-2022 走看看