• [日常] 前端资源测试机上忽略版本号的的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 / {
        }
    
    }
  • 相关阅读:
    MyBatisPlus简单查询
    vue Composition API官网
    操作mysql脚本
    elbutton 自定义背景图片
    k8s 应用yaml
    分页查询
    nodejs 工具库
    eltablecolumn的转义,eltablecolumn根据返回的数据判断
    谷歌地图在线
    YOLOX在OpenVINO、ONNXRUNTIME、TensorRT上面推理部署与速度比较
  • 原文地址:https://www.cnblogs.com/taoshihan/p/11900573.html
Copyright © 2020-2023  润新知