apache轉發規則 + nginx location 正則匹配經典案例


-1.需求:兩個事情,把測試環境release得微服務接口都開放一個外網端口出來(tqy.do1.net.cn/微服務名稱/  映射到 ip:port/micro 上)也可以提供下ip連接,給測試小伙伴做壓測

ProxyPass "/dqsf-report/" "http://dqdp-report-boot:8887/micro/" 
ProxyPassReverse "/dqsf-report/" "http://dqsf-report-boot:8887/micro/"

 

0.apache的proxypass瀏覽器url不會變

我們想要的效果是請求http://qwyimg.haha.com.cn/......直接返回結果,而不是請求http://qwyimg.haha.com.cn/......返回一個地址,在通過這個返回的地址在去請求拿到結果

ProxyPass "/qiqiao/storage/oss/files/" "http://10.0.2.11:8000/qiqiao/runtime/api/v1/storage/oss/files/"
ProxyPassReverse "/qiqiao/storage/oss/files/" "http://10.0.2.11:8000/qiqiao/runtime/api/v1/storage/oss/files/"

server_name qy.haha.com.cn 0.0.0.0 qwyimg.haha.com.cn;
nginx的location
ProxyPass /qiqiao/storage/oss/files https://qy.haha.com.cn/qiqiao/runtime/api/qiqiao/storage/oss/files/storage/oss/files/
ProxyPassReverse /qiqiao/storage/oss/files https://qy.haha.com.cn/qiqiao/runtime/api/qiqiao/storage/oss/files/storage/oss/files/


 

1.apache轉發規則

運維側修改管理后台與個人網頁版的apache配置實現以下跳轉:

/qwy/manager/login.jsp 修改為https://qy.haha.com.cn/qwy/login

/qwy/manager/loginweb.jsp 修改為https://qy.haha.com.cn/qwy/login

/web/manager/login.jsp 修改為https://qy.haha.com.cn/web/login

/web/manager/loginweb.jsp 修改為https://qy.haha.com.cn/web/login

RewriteEngine On

這個還是跳的登錄頁面,明天調整下,跳到/login www.a.com/dev-wxqyh/manager/login.jsp

RewriteCond %{REQUEST_URI} ^/.*/manager/login.*.jsp
RewriteRule ^/(.*)/manager/login(.*).jsp /($1)/login




RewriteCond
%{REQUEST_URI} ^/qwy/manager/login.*.jsp
RewriteRule .* https://qy.haha.com.cn/qwy/login

RewriteCond %{REQUEST_URI} ^/web/manager/login.*.jsp
RewriteRule .* https://qy.haha.com.cn/web/login


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM