我有一个问题。我有两个网络应用程序部署为 war 。我们将它们称为 app1.war 和 app2.war。
我希望通过 URL www.website.com 访问 app1.war,并且希望通过 www.anotherweb.com 访问 app2.war。我已准备好域名。
我能够以 www.website.com/app1、www.website.com/app2 的身份运行该应用程序。
所以现在我需要使用 www.website.com 和 www.anotherweb.com 运行
我正在运行 JBoss7.1.1。
感谢您提供任何见解。
最佳答案
您需要输入 Apache Http server在用户和 JBoss 服务器之间,不要直接从 Web 访问您的服务器。配置 Apache HTTP 服务器以使用 mod_proxy与 virtual host配置。如果您的 JBoss 服务器在 http://localhost:8080
上运行,它在 httpd.conf
中将类似于此。
NameVirtualHost *:80
<VirtualHost *:80>
RewriteEngine On
ServerName www.website.com
ProxyPass / http://localhost:8080/app1/
ProxyPassReverse / http://localhost:8080/app1/
</VirtualHost>
<VirtualHost *:80>
RewriteEngine On
ServerName www.anotherweb.com
ProxyPass / http://localhost:8080/app2/
ProxyPassReverse / http://localhost:8080/app2/
</VirtualHost>
关于java - jboss 7.1.1 中两个 Web 应用程序的两个 DNS 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20472963/