Using the Apache httpd (mod_cluster) and JBoss architecture for highly available cluster environments, use Apache httpd (MOD_JK) and JBoss architectures for highly available cluster environments and use Apache httpd (mod_proxy) As described in the highly available cluster environment of the JBoss architecture, we typically build cluster applications by using the Apache server that precedes the JBoss cluster as a load balancer, and in this case, an HTTP request is roughly as shown in the following illustration:
MyApp deployed in JBoss, JBoss listening to 8080 port Apache listening on 80 ports, can forward requests to the background JBoss domain name resolver according to the relevant domain name such as example.com can be resolved to the Apache server, for example, the user through the http:/ /example.com/myapp can access the application deployed in JBoss MyApp as shown in the graph, the terminal application in the browser input URL http://example.com/myapp, domain name resolution server through example.com resolution to Apache Server (IP) corresponds to the physical machine, Apache accesses the application based on the suffix MyApp in the URL. However, in the actual application of the URL suffix does not apply the name, that is, through http://example.com to access the MyApp, as shown in the following figure:
This article demonstrates how to copy and path to a specific application MyApp in Apache server. The following demo is based on Linux server (Linux 2.6.43.8-1.fc15.i686.pae), Apache server 2.22,jboss Server 7.1, the following steps are specific:
1. Deployment Myapp.war to JBoss (deployed in 4 ways to Jboss7/wildfly), Myapp.war includes only index.html, and contains one line of string as follows:
This is index.html under MyApp
When you start JBoss, you can access it through Http://localhost:8080/myapp, and the page appears with the string "This is index.html under MyApp."
2. Configure Linux Server, edit/etc/hosts as follows:
127.0.0.1 localhost
127.0.0.1 example.com
This allows access to the Apache server running on the local computer via example.com.
3. Configure the Apache server, using the Apache httpd (mod_cluster) and JBoss architecture for a highly available cluster environment, using the Apache httpd (MOD_JK) and JBoss architectures for highly available cluster environments and Use the Apache httpd (mod_proxy) and JBoss architecture high-availability cluster environment to configure the forwarding between the Apache server and JBoss, configuration complete through Http://localhost/myapp can access deployment and JBoss MyApp, that is, the string "This is index.html under MyApp" Output to the interface
4. Configure Apache server, add mod_rewrite forwarding configuration, edit httpd.conf, add the following configuration:
Rewriteengine on
rewritecond %{request_uri} !^/myapp/
rewriterule ^/(. *)/myapp/$1 [PT]
Configuration complete, restart the Apache server, through http://example.com/access, the page output is as follows: