根据 URL 从 80 端口重定向到不同的端口 [英] Redirecting from port 80 to different ports based on URL

查看:36
本文介绍了根据 URL 从 80 端口重定向到不同的端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个应用程序(Atlassian JIRA 和 Confluence)侦听端口 8080 和 8090,可通过 example.com:8080/jira 和 example.com:8090/confluence 访问.我想在端口 80 上设置重定向,以便我可以通过 example.com/jira 和 example.com/confluence 访问服务.

I have two applications, (Atlassian JIRA and Confluence,) listening on ports 8080 and 8090, accessible through example.com:8080/jira and example.com:8090/confluence. I would like to set up a redirection on port 80 such that I can access the services through example.com/jira and example.com/confluence.

有没有简单的方法来实现这一目标?

Is there a simple way to achieve this?

推荐答案

有两种方法可以解决这个问题.

There are 2 ways of solving this.

重定向方法

  1. 您似乎很精明地设置服务器.您将需要在端口 80 上运行的 Web 服务器.(Apache:Windows/*nix;IIS:Windows)
  2. 如果您只需要 example.com/jira 和 example.com/confluence,请设置一个虚拟站点/文件夹.如果您的 DNS 记录指向主机,您也可以使用 jira.example.com 和 confluence.example.com.
  3. 使用 302 重定向(临时/已找到)将点击此 URL/虚拟主机的浏览器重定向到新 URL.此方法会更改浏览器中的 URL,因此浏览器实际上会显示 8080 和 8090 端口.

代理方法

另一种方式,如果您想要透明的 URL,将在 2 个 URL 上设置反向代理.这样,端口 80 上的代理服务器就好像内容来自端口 80 一样响应客户端.Web 服务器在后台获取页面并提供它们.您可以获得使用反向代理缓存内容的额外好处.

The other way, if you wanted transparent URLs would be to set up reverse proxies on the 2 URLs. This way the proxy server on port 80 responds to the client as if the content is originating from port 80. The web server fetches the pages in the background and serves them up. You have the added benefit of caching content using a reverse proxy.

这篇关于根据 URL 从 80 端口重定向到不同的端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆