Use Apache in Linux to implement domain name Forwarding (Tomcat/JBOSS)

Source: Internet
Author: User

Use Apache in Linux to implement domain name Forwarding (Tomcat/JBOSS)

Install and configure JDK in Linux. There is a lot of information on the Internet;

When installing apache, you may encounter many problems, such as APR not found and pcre-config for libpcre not found, which are related to the specific environment of the system, the detailed solution is not detailed here. We recommend several solutions to solve the problem based on the specific situation. Do not rely too much on a specific solution. You must take the right remedy. link address:

Http://www.cnblogs.com/JemBai/archive/2012/11/07/2759139.html

Http://blog.csdn.net/chaijunkun/article/details/6987443

Http://blog.csdn.net/yaday/article/details/7535818

To put it bluntly, after the system environment is configured, download the mod_jk.so component and put it in the apache/modules/directory;

Step 2: Add the following content to the httpd. conf file:

 
 
  1. <Span style = "white-space: pre"> </span> # load the mod_jk Module
  2. LoadModule jk_module modules/mod_jk.so
  3. # Specify the location of the configuration file workers. properties required by the mod_jk Module
  4. JkWorkersFile conf/workers. properties
  5. # Specify the location of the log file of the mod_jk Module
  6. JkLogFile logs/mod_jk.log
  7. # Specify the Log Level of the mod_jk Module
  8. JkLogLevel warn
  9. # Specify the log format of the mod_jk Module
  10. JkLogStampFormat "[% a % B % d % H: % M: % S % Y]

Add location to the bottom of LoadModule

 
 
  1. <span style="white-space:pre"><span style="font-family:SimHei;font-size:14px;"><VirtualHost *:80>    
  2.   ServerName aaa.box.com    
  3.   ServerAlias   aaa.box.com   
  4.   JkMount /* tomcat01    
  5. </VirtualHost>    
  6. <VirtualHost *:80>    
  7.   ServerName bbb.box.com     
  8.   ServerAlias  bbb.box.com    
  9.   JkMount /* tomcat02    
  10. </VirtualHost>    
  11. <VirtualHost *:80>    
  12.   ServerName ccc.box.com    
  13.   ServerAlias   ccc.box.com    
  14.   JkMount /* tomcat03    
  15. </VirtualHost></span></span> 

You can also create a separate jk. conf file, put the above Code into jk. conf, and add Include conf/jk. conf in httpd. conf.

Step 2: add workers. properties in the apache/conf directory. The Code is as follows:

 
 
  1. worker.list = tomcat01,tomcat02,tomcat03  
  2.  
  3. # ------------------------    
  4. # First tomcat server    
  5. # ------------------------    
  6. worker.tomcat01.port=8099    
  7. worker.tomcat01.host=localhost    
  8. worker.tomcat01.type=ajp13    
  9. # ------------------------    
  10. # Second tomcat server    
  11. # ------------------------    
  12. worker.tomcat02.port=8011    
  13. worker.tomcat02.host=localhost    
  14. worker.tomcat02.type=ajp13 
  15. # ------------------------    
  16. # Third tomcat server    
  17. # ------------------------    
  18. worker.tomcat03.port=8008    
  19. worker.tomcat03.host=localhost    
  20. worker.tomcat03.type=ajp13 

Restart apache.

Note:

1. If apache version is earlier than 2.4, add NameVirtualHost *: 80 before <VirtualHost *: 80>.

2. The workers. properties file must contain workers. properties. Otherwise, Error 500 will be reported.

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.