侧边栏壁纸
  • 累计撰写 105 篇文章
  • 累计创建 153 个标签
  • 累计收到 55 条评论
标签搜索

目 录CONTENT

文章目录

Nginx转发请求到新域名同时不改变URL

北纬36度
2021-02-22 / 0 评论 / 0 点赞 / 289 阅读 / 1,092 字 / 正在检测是否收录...

将请求路径https://kevin.com/data/test跳转到https://rubao.com/data/test/test.html页面。

server {
    listen       443;
    server_name  kevin.com;
    access_log  /data/nginx/logs/kevin.com-access.log main;
    error_log  /data/nginx/logs/kevin.com-error.log;
  
    ssl on;
    ssl_certificate /data/nginx/ssl/kevin.com.crt;
    ssl_certificate_key /data/nginx/ssl/kevin.com.key;
    ssl_session_timeout 5m;
  
    location = /data/test {
        rewrite /data/test /data/test/test.html break;
        proxy_pass https://rubao.com;
    }
}
将访问172.16.60.16:8082/m2/order/secretRecording的请求跳转到172.16.60.28:8089/order/secretRecording
```xml
server {
    listen       443;
    server_name  kevin.com;
    access_log  /data/nginx/logs/kevin.com-access.log main;
    error_log  /data/nginx/logs/kevin.com-error.log;
  
    ssl on;
    ssl_certificate /data/nginx/ssl/kevin.com.crt;
    ssl_certificate_key /data/nginx/ssl/kevin.com.key;
    ssl_session_timeout 5m;
  
    location = /data/test {
        rewrite /data/test /data/test/test.html break;
        proxy_pass https://rubao.com;
    }
} 
``` 
0

评论区