Two DNS Names for two Web apps in jboss 7.1.1

倖福魔咒の 提交于 2019-12-31 05:42:09

问题


I have a problem. I have two web apps deployed as wars. Let's call them app1.war and app2.war.

I would like app1.war to be accessed at the URL www.website.com and I would like app2.war to be accessible as www.anotherweb.com. I have my domain name ready.

I am able to run the application as www.website.com/app1, www.website.com/app2.

So Now i need to run using www.website.com and www.anotherweb.com

I am running JBoss7.1.1.

Thanks for any insights.


回答1:


You need to put Apache Http server between user and JBoss server and not access your server directly from web. Configure Apache HTTP server to use mod_proxy with virtual host configuration. If your JBoss server runs on http://localhost:8080, it will look something like this in 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>


来源:https://stackoverflow.com/questions/20472963/two-dns-names-for-two-web-apps-in-jboss-7-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!