Integrate WAMP with Tomcat

Source: Internet
Author: User
1. Install wamp and JDK. (Not introduced) 2. Download and install tomcat at http://tomcat.apache.org/download-70.cgi. choose the installation package for the system. I am a 64-bit system and directly choose the 64-bit installation package.

3. Download JK, notebook., Apaceh version 2.4.2, and the system is 64-bit, so directly choose: http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/tomcat-connectors-1.2.37-windows-x86_64-httpd-2.4.x.zip 4. the system for installing tomcat is: C: \ Program Files (x86) \ Apache Software Foundation \ Tomcat 7.0 5. go to the conf directory in the Tomcat folder and configure it accordingly. Creation: workers. properties, the content is as follows: workers. tomcat_home = "C: \ Program Files (x86) \ Apache Software Foundation \ Tomcat 7.0 \" # Let the mod_jk module know the Tomcat installation path workers. java_home = "C: \ Program Files (x86) \ Java \ jdk1.7.0 \" # Let the mod_jk module know the jdk path ps = "worker. list = ajp13 # The key here is the name and httpd. conf is consistent. If httpd. conf is changed here, it should also be changed. Worker. ajp13.port = 8009 # Working port, jk listening port of tomcat, you can view Server. port = "8009" worker in xml. ajp13.host = localhost # The machine where Tomcat is located. If it is installed on a machine different from apache, you need to set IP worker. ajp13.type = ajp13 # type. It seems that it cannot be changed. A worker may fail. ajp13.lbfactor = 1 # Load Balancing FactorNote: The path must be configured according to the actual path of the system during installation.6. Configure the server. xml file under the conf directory. Virtual directory settings: Find <Host name = "localhost" appBase = "webapps" unpackWARs = "true" autoDeploy = "true">: <Host name = "localhost" debug = "0" appBase = "d:/wwwroot" unpackWARs = "true" autoDeploy = "true"> Where "d: /wwwroot "is the main directory of tomcat, which can be specified according to the actual situation. Configure Tomcat listening port: Find: <Connector port = "8080" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443"/> find: <Connector executor = "tomcatThreadPool" port = "8080" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443"/> modify: change the port to the required port number. If this line is commented out: <Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443"/> remove the comment. This line is the port configuration for apache to communicate with tomcat, to work with the preceding workers. worker in properties. ajp13.port = 8009 is consistent. 7. Load the JK module in apache and enter the directory C: \ wamp \ bin \ apache \ apache2.4.2 \ modules. Decompress mod_jk.so In the downloaded JK package to the modules directory. In http. add the following content to the conf file: LoadModule jk_module modules/mod_jk.so JkWorkersFile "C:/Program Files (x86)/Apache Software Foundation/Tomcat 7.0/conf/workers. properties "JkLogFile" C:/wamp/bin/apache/apache2.4.2/logs/mod_jk.log "JkMount /*. jsp ajp13 JkMount /*. do ajp13 8. test whether the configuration is successful. Create the test directory under the Directory d: \ wwwroot configured above, and then create test. jsp file with the following content: <% @ page contentType = "text/html; charset = gb2312" %> <HTML> <HEAD> <TITLE> JSP test page </TITLE> </HEAD> <BODY> <% out. println ("

<VirtualHost *: 80> DocumentRoot "d: /wwwroot "ServerName lfire.com ServerAlias mounts # support for JSP JkMount/temp ajp13 JkMount/temp/* ajp13 JkMount/bin ajp13 JkMount/bin/* ajp13 JkMount/deployer ajp13 JkMount/deployer /* ajp13 JkMount/ajp13 JkMount/jre_bak/* ajp13 JkMount/logs ajp13 JkMount/logs/* ajp13 JkMount/webapps ajp13 JkMount/webapps/* ajp13 JkMount/work ajp13 J KMount/work/* ajp13 JkMount/lib ajp13 JkMount/lib/* ajp13 JkMount/conf ajp13 JkMount/conf/* ajp13 JkMount/jre ajp13 JkMount/jre/* ajp13 # Later 3 is the key, the previous JkMount depends on your situation. Of course, it is harmless to write more. JkMount/*/servlet/* ajp13 JkMount/*. jsp ajp13 JkMount/*. do ajp13 </VirtualHost>
10. in tomcat configuration, open the server under the conf directory of tomcat. add the following content to the xml file: <Host name = "www.lfire.com" unpackWARs = "true" autoDeploy = "true" xmlValidation = "false" xmlNamespaceAware = "false"> <Context path = "" docBase = "D: \ wwwroot "privileged =" true "antiResourceLocking =" false "> </Context> </Host> Note: The keyword is case sensitive.11. Security Configuration
Configure httpd. conf file. In this way, the root directory of tomcat and apache is set to the same directory, but you must restrict access to some files in the directory, such as the web-inf stored in the class, in httpd. add the following code under conf: # denytheaccesstoWEB-INF <Directory "/WEB-INF/"> order allow, deny Deny from all </Directory> so that when you try to remember http: // localhost/web-inf/, apache will reject it.
Refer: Http://blog.csdn.net/wangyuchen890119/article/details/7234679

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.