使用 apache 代理在同一端口 80 上的两个应用程序?

Two applications on same port 80 with apache proxy?

我在一台服务器上有两个应用程序:Apache 下的 Redmine 运行ning 和 WildFly 下的应用程序 运行ning。现在,Redmine 运行s 在端口 80 上,其他应用程序 运行s 在端口 8080 上。

是否可以使用 Apache 反向代理 运行 它们都在端口 80 上?该服务器将分配两个域名:app.domain.com 用于 WildFly 下的应用程序和 redmine.domain.com 用于 Apache 下的 redmine 应用程序。

是否可以实现以下行为?

我访问 redmine.domain.com,我被重定向到 /var/www/redmine DocumentRoot 文件夹。

当我访问 client.domain.com 时,我被重定向到 http://localhost:8080

谢谢

使用 apache 很容易做到这一点。您不能将两个应用程序绑定到一个端口,但可以让 apache 路由它们。

你想做的是运行 Apache 在 80 端口,wildfly 在 8080,redmine 在 8081。

在 apache 中,配置如下所示:

<VirtualHost app.domain.com:80>
    ProxyPass / http://127.0.0.1:8080/ retry=0
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
<VirtualHost redmine.domain.com:80>
    ProxyPass / http://127.0.0.1:8081/ retry=0
    ProxyPassReverse / http://127.0.0.1:8081/
</VirtualHost>