nginx匹配以XXX结尾的

匹配以do结尾的所有文件;如http://192.168.126.168:8080/delivery/transportPlanData.do?startRelease=2019-07-06&endRelease=2019-07-06&_search=false&nd=1562309595650&rows=20&page=1&sidx=&sord=asc&kunna=&bezei=&vtext=

server {
    listen       8888;
    server_name  localhost;

   # charset koi8-r;
    access_log  logs/bbb.access.log  main;
    error_log   logs/bbb.error.log;

    location /jing {
        alias  /usr/share/nginx/html;
        index  index.html index.htm;
    }

    location ~*\.(do)$ {
                 proxy_redirect off;
                 proxy_set_header  Host  $host;
                 proxy_set_header  X-Real-IP  $remote_addr;
                 proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
                 proxy_pass http://192.168.126.168:8080;
   }
}

 

location / {
                        try_files $uri @apache;
                        }
#所有的路径都是/开头,表示匹配所有
                location @apache {
                        internal;
                        proxy_pass http://127.0.0.1:1080;
                        include proxy.conf;
                        }
#url重定向至@apache规则
                location ~ .*\.(php|php5)?$
                        {
                                proxy_pass http://127.0.0.1:1080;
                                include proxy.conf;
                        }
#匹配所有以.php或者.php5的URL, ~表示区分大小写
                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }
#匹配以.gif,.jpg,.jpeg,.png,.bmp,.swf结尾的url
                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }
#匹配以.js或者.css结尾的url

转载于:https://www.cnblogs.com/xingyunfashi/p/11231366.html

你可能感兴趣的:(nginx匹配以XXX结尾的)