JBoss Series 91: The highly available cluster environment built by JBoss uses the Apache mod_rewrite forwarding root path to specific applications

Source: Internet
Author: User
Tags jboss jboss server

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, 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:   localhost   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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.