-
1. Re: Need advice on best way to architect a multiple-web-app solution with AS7
poesys Mar 18, 2013 1:44 PM (in response to poesys)I'm going to work on a virtual host solution for now, as no one seems to have any great ideas about a simpler way.
- Create a subdomain payment.arabidopsis.org.
- Add an Apache virtual host with SSL
- Configure jboss-web.xml with the virtual host
- Configure a server in standalone.xml
I still think this is way more complex than should be required for two simple web apps running under a single server. But apparently not.
-
2. Re: Need advice on best way to architect a multiple-web-app solution with AS7
poesys Mar 19, 2013 6:58 PM (in response to poesys)Here's my solution to this problem.
1. Configure the main web app to the root context and don't specify a virtual host in jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
</jboss-web>
2. Configure the second web app to the default context for the web app and specify a virtual host in jboss-web.xml:
<jboss-web>
<virtual-host>payment.arabidopsis.org</virtual-host>
</jboss-web>
3. Configure two virtual servers in the JBoss standalone.xml configuration file using localhost and the main domain name for the default host server and the exact same JBoss virtual host name for the sub-domain/second web app server:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="AJP" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="localhost"/>
<alias name="www.arabidopsis.org"/>
</virtual-server>
<virtual-server name="payment.arabidopsis.org" default-web-module="payment"/>
4. Configure two virtual hosts in httpd.conf or conf.d/vhosts.conf using NameVirtualServers, with one being the www.arabidopsis.org server name and the other being the payment.arabidopsis.org server name, again with the second name being the exact same JBoss virtual host name. Proxy statemens pass through the requests to the localhost:8080 JBoss server, with the proxy statements for the second web app's virtual host looking like this:
<VirtualHost *:80>
ServerName payment.arabidopsis.org
ServerAlias payment.arabidopsis.org
ProxyPass / ajp://localhost:8009/payment
ProxyPassReverse / ajp://localhost:8009/payment
And that's it. Complicated, but it now seems to work once I got all the pieces properly aligned with the same name. When you type "www.arabidopsis.org" you get to the main web app; when you type "payment.arabidopsis.org" you get to the second web app.