【发布时间】:2015-02-23 01:13:20
【问题描述】:
关于 SO 有一些类似的问题,但没有一个完全是我的问题,到目前为止,我没有运气尝试调整他们的答案。
我想将 URL http://sub.example.com 映射到 https://123.12.12.12/path,这样浏览器仍然会显示 URL http://sub.example.com。
我的 Nginx 配置文件看起来像,
server {
listen 80;
server_name sub.example.com;
location / {
proxy_pass https://123.12.12.12;
rewrite ^/$ /path last;
}
}
路由在这里有效,但显示的 URL 是 http://sub.example.com/path。如何让它只显示http://sub.example.com?
【问题讨论】:
-
你会被重定向到
http://sub.example.com/path吗? -
是的,不过我如何做到
http://sub.example.com? -
你需要消除重定向
-
如何消除重定向?