• 伪静态

    rewrie 正则 替代内容 flag标记

    flag标记说明

    • last 本条规则匹配完成后,继续向下匹配新的location规则
    • break 本条规则匹配完成后立即终止
    • redirect 返回302临时重定向
    • permanent 返回301永久重定向

    image-20230226190057156

    image-20230226190231919

    image-20230226190257402

    image-20230226190308894

    server {
            listen 80;
            server_name 192.168.12.7;
            location / {
                    rewrite  ^/images/([0-9]+).jpg$ /imgs/$1.jpg break;
                    #proxy_pass http://httpds;
                    root /www/default;
            }
    }

    image-20230226190434359

  • 防盗链配置

    valid_referers none | blocked | server_names;
    if( $invalid_referer ){
      return 403;
    }

    image-20230226195527021