nginx反向代理和rewrite進行解決跨域問題 去掉url中的一部分字串,通過nginx正則生成新的url
阿新 • • 發佈:2018-11-14
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow
也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!
場景:表面上訪問的是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 {
proxy_pass http://127.0.0.1:8888;
}
location ^~ /tpl {
proxy_pass http://127.0.0.1:8888;
}
location ~ .*/tpl/ {
#alias E:/UCMSServer/tomcat/webapps/tpl/;
#index index.shtml index.html index.htm;
}
location ^~ /preview {
proxy_pass http://127.0.0.1:8888;
}
}
以下方式是正則匹配以mp4結尾的方式
location ~ \.mp4$ {
root /data;
mp4;
mp4_buffer_size 1m;
mp4_max_buffer_size 500m;
}