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

查看:765
本文介绍了根据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?

推荐答案

有两种解决方法.

重定向方法

  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,则将在这两个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天全站免登陆