場景:表面上通路的是http://127.0.0.1:7777/test/xhtml//tpl/app-tpl-webapp/css/base.css,
實際上看的是http://127.0.0.1:8888/tpl/app-tpl-webapp/css/base.css的内容。
server {
listen 7777;
server_name 127.0.0.1;
location ^~ /website-webapp {
proxy_pass http://127.0.0.1:8888;
}
location ^~ /app-tpl-webapp {
location ^~ /tpl {
location ~ .*/tpl/ {
#alias e:/ucmsserver/tomcat/webapps/tpl/;
#index index.shtml index.html index.htm;
rewrite ^/(.*)/tpl/(.*)$ http://127.0.0.1:7777/tpl/$2; #其中$2表示的是正則中的第二串
}
location ^~ /preview {
}
以下方式是正則比對以mp4結尾的方式
location ~ \.mp4$ {
root /data;
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 500m;
}