Nginx隱藏式跳轉(zhuǎn)(瀏覽器URL跳轉(zhuǎn)后保持不變)
Nginx的隱藏式跳轉(zhuǎn)可以實(shí)現(xiàn)將請(qǐng)求跳轉(zhuǎn)到另一個(gè)網(wǎng)站的頁面,并且瀏覽器中URL保持不變。Nginx配置中需要使用rewrite規(guī)則。下面提供兩個(gè)示例來說明這種跳轉(zhuǎn)需求的配置:
一、Nginx隱藏式跳轉(zhuǎn)配置示例1
將請(qǐng)求路徑https://jb51.net/data/test跳轉(zhuǎn)到https://jb51.com/data/test/test.html頁面。
server { listen 443; server_name jb51.net; access_log /data/nginx/logs/jb51.net-access.log main; error_log /data/nginx/logs/jb51.net-error.log; ssl on; ssl_certificate /data/nginx/ssl/jb51.net.crt; ssl_certificate_key /data/nginx/ssl/jb51.net.key; ssl_session_timeout 5m; location = /data/test { rewrite /data/test /data/test/test.html break; proxy_pass https://jb51.com; } }
二、Nginx隱藏式跳轉(zhuǎn)配置示例2
將訪問172.16.60.16:8082/m2/order/secretRecording的請(qǐng)求跳轉(zhuǎn)到172.16.60.28:8089/order/secretRecording
server { listen 8082; server_name 172.16.60.16; index index.html index.php index.htm; location ~* ^/m2/order/secretRecording { proxy_next_upstream error timeout http_503 http_504 http_502; proxy_connect_timeout 500s; proxy_read_timeout 500s; proxy_send_timeout 500s; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; rewrite ^(.*)$ /order/secretRecording break; #先改寫URI地址 proxy_pass http://172.16.60.28:8089; #跳轉(zhuǎn) } }
更多關(guān)于Nginx隱藏式跳轉(zhuǎn)的文章請(qǐng)查看下面的相關(guān)鏈接
- 詳解NGINX訪問https跳轉(zhuǎn)到http的解決方法
- nginx rewrite 實(shí)現(xiàn)URL跳轉(zhuǎn)的方法
- Nginx服務(wù)器中HTTP 301跳轉(zhuǎn)到帶www的域名的方法
- nginx強(qiáng)制使用https訪問的方法(http跳轉(zhuǎn)到https)
- Nginx根據(jù)不同瀏覽器語言配置頁面跳轉(zhuǎn)的方法
- nginx 解決首頁跳轉(zhuǎn)問題詳解
- 詳解nginx 301跳轉(zhuǎn)到帶www域名方法
- 關(guān)于nginx沒有跳轉(zhuǎn)到upstream地址的解決
- 如何通過nginx負(fù)載均衡跳轉(zhuǎn)https
- 利用Nginx的map指令實(shí)現(xiàn)頁面跳轉(zhuǎn)
- 解決thinkPHP 5 nginx 部署時(shí),只跳轉(zhuǎn)首頁的問題
- 使用Nginx實(shí)現(xiàn)301跳轉(zhuǎn)至https的根域名示例代碼
- nginx禁止直接通過ip進(jìn)行訪問并跳轉(zhuǎn)到自定義500頁面的操作
- Nginx rewrite跳轉(zhuǎn)應(yīng)用場(chǎng)景詳解
- nginx開啟HSTS讓瀏覽器強(qiáng)制跳轉(zhuǎn)HTTPS訪問詳解
- nginx里的rewrite跳轉(zhuǎn)的實(shí)現(xiàn)
- Nginx中l(wèi)ocation匹配以及rewrite重寫跳轉(zhuǎn)詳解
相關(guān)文章
基于Nginx禁止指定IP、國外IP訪問我的網(wǎng)站
這篇文章主要介紹了用Nginx禁止指定IP、國外IP訪問我的網(wǎng)站,想要實(shí)現(xiàn)這個(gè)功能方法有很多種,這里基于 Nginx 的 ngx_http_geoip2 模塊來禁止國外 IP 訪問網(wǎng)站,需要的朋友可以參考下2022-05-05WebApi部署多服務(wù)器配置Nginx負(fù)載均衡的教程
這篇文章主要介紹了WebApi部署多服務(wù)器配置Nginx負(fù)載均衡 ,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03Nginx geoip模塊實(shí)現(xiàn)地區(qū)性負(fù)載均衡
相信做過awstats的都用過開源的geoip.dat ip數(shù)據(jù)庫,剛好nginx wiki上有g(shù)eoip 模塊,這樣就可以實(shí)現(xiàn)地區(qū)性的負(fù)載均衡,但是maxmind 的ip數(shù)據(jù)庫對(duì)中國的支持不算太好,不過現(xiàn)在也不錯(cuò)了~2010-12-12Nginx 域名轉(zhuǎn)發(fā)的實(shí)現(xiàn)
這篇文章主要介紹了Nginx 域名轉(zhuǎn)發(fā)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08Nginx stream 配置代理(Nginx TCP/UDP 負(fù)載均衡)
本文主要介紹了Nginx stream 配置代理(Nginx TCP/UDP 負(fù)載均衡),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-11-11iis+nginx實(shí)現(xiàn)負(fù)載均衡的詳細(xì)步驟
這篇文章主要為大家詳細(xì)介紹了iis+nginx實(shí)現(xiàn)負(fù)載均衡的詳細(xì)步驟 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07centos環(huán)境下nginx高可用集群的搭建指南
為了防止Nginx單點(diǎn)故障造成服務(wù)器癱瘓,本文介紹了Nginx實(shí)現(xiàn)高可用集群構(gòu)建,下面這篇文章主要給大家介紹了關(guān)于centos環(huán)境下nginx高可用集群的搭建指南,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-07-07