nginx配置总结

1.   使用&代替?

http://test.com/testpaper/testType?testType=14?schoolId=101434&courseId=479473&classId=63316
if ($request_uri ~ /testpaper/testType\?(.*=[0-9].*)(\?)(.*)) {
set $param1 $1;
set $param2 $2;
set $param3 $3;
rewrite ^/testpaper/testType?([a-z][A-Z].+=[0-9].+)?(.*) http://test2018.com/testpaper/testType?$param1&$param3? break;
}

2.配置跳转url地址不变

 

location /k12_unlock {
proxy_set_header Host abc.baidu.com;
proxy_pass https://abc.baidu.com/fen/inland/k12/one-yuan/home/oneyuanunlock_1;

}

location ^~ /workbench/ {
alias /tol/htdocs/kooup-node-xueguan-admin-neibu/;
}   ##匹配后不再往下匹配

rewrite ^/workbench/(.*)$  /workbench/index.html last;  #地址栏地址不变

posted @ 2019-01-22 18:39  liumj  阅读(130)  评论(0编辑  收藏  举报