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:
- <Span style = "white-space: pre"> </span> # load the mod_jk Module
- LoadModule jk_module modules/mod_jk.so
- # Specify the location of the configuration file workers. properties required by the mod_jk Module
- JkWorkersFile conf/workers. properties
- # Specify the location of the log file of the mod_jk Module
- JkLogFile logs/mod_jk.log
- # Specify the Log Level of the mod_jk Module
- JkLogLevel warn
- # Specify the log format of the mod_jk Module
- JkLogStampFormat "[% a % B % d % H: % M: % S % Y]
Add location to the bottom of LoadModule
- <span style="white-space:pre"><span style="font-family:SimHei;font-size:14px;"><VirtualHost *:80>
- ServerName aaa.box.com
- ServerAlias aaa.box.com
- JkMount /* tomcat01
- </VirtualHost>
- <VirtualHost *:80>
- ServerName bbb.box.com
- ServerAlias bbb.box.com
- JkMount /* tomcat02
- </VirtualHost>
- <VirtualHost *:80>
- ServerName ccc.box.com
- ServerAlias ccc.box.com
- JkMount /* tomcat03
- </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:
- worker.list = tomcat01,tomcat02,tomcat03
-
- # ------------------------
- # First tomcat server
- # ------------------------
- worker.tomcat01.port=8099
- worker.tomcat01.host=localhost
- worker.tomcat01.type=ajp13
- # ------------------------
- # Second tomcat server
- # ------------------------
- worker.tomcat02.port=8011
- worker.tomcat02.host=localhost
- worker.tomcat02.type=ajp13
- # ------------------------
- # Third tomcat server
- # ------------------------
- worker.tomcat03.port=8008
- worker.tomcat03.host=localhost
- 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.