WINDOWS+PHP5.5+APACHE2.4+TOMCAT+MOD_JK Configuration

Source: Internet
Author: User
Tags php write

Reason:

In general, Apache is running 80 ports, such as Apache after the boot run localhost:80 can appear it works page, where 80 can not write, will default. The default port when Tomcat starts is 8080 port, need to add 8080 after localhost, but this is less professional, the domain name also has port, so we can change the Server.xml to 80 in Tomcat. But now the problem comes out, when there is a PHP write project in the use of Apache as a service, we will let PHP write projects and JSP write projects run at the same time, here will need to use the plugin mod_jk, It can put the URL that the JSP wants to access into Tomcat for processing by Tomcat.

Tomcat directly download the decompression on the official website (http://tomcat.apache.org/), of course, the premise of starting Tomcat is that you install the JDK, will be JAVA_HOME=JDK installation directory in your environment variables, this is relatively simple, We mainly explain the configuration of apache2.4 and MOD_JK.

One: apache2.4 and php5.5 and MySQL configuration

I don't want to talk more about this part. Reference: http://jingyan.baidu.com/article/9faa723152c5d6473d28cb47.html

II: MOD_JK Configuration

First, you need to download the Apache version of the mod_jk.so file from the official website and put it under Apache's modules directory.

Then build two files under the Conf directory for workers.properties and mod_jk.conf

Workers.properties content:

Workers.tomcat_home= "D:/APACHE-TOMCAT7" Workers.java_home= "D:/TOOLS/JAVA/JDK" # Defining a worker named Worker1 and of Type ajp13worker.list=worker1# Set properties for worker1worker.worker1.type=ajp13worker.worker1.host= Localhostworker.worker1.port=8009worker.worker1.lbfactor=1

Mod_jk.conf content: (MyProject is the project name of the JSP)

LoadModule jk_module modules/mod_jk.sojkworkersfile conf/workers.propertiesjklogfile logs/mod_jk.logjkloglevel Infojklogstampformat "[%a%b%d%h:%m:%s%Y]" jkoptions +forwardkeysize +forwarduricompatunparsed + Forwarddirectoriesjkrequestlogformat "%w%V%T" jkmount/servlet/* worker1jkmount/*.jsp worker1jkmount/*.action Worker1jkmount/*.do worker1jkmount/myproject/* Worker1

Note: Jkoptionszhong in the forwarduricompatunparsed is not Forwarduricompat , Otherwise there will be garbled

Then add the httpd.conf in the Apache conf directory:

Include conf/mod_jk.conf

Three: Tomcat configuration

Rename the appbase in Server.xml in Tomcat to your location in the Apache configuration project.

This way, when you access the JSP project in the browser, Apache will automatically post your access to Tomcat for processing so that both PHP and JSP can be accessed without having to write the port number.

Note: The reference also has configuration virtualhost, which may be done when Tomcat uses a port number that cannot be accessed by the extranet, and I do not study here, but it works.

Reference documents:

1:http://jingyan.baidu.com/article/9faa723152c5d6473d28cb47.htmlwin7 (64-bit) php5.5-apache2.4-mysql5.6 environment installation

2:http://wenku.baidu.com/view/9288fa2058fb770bf78a55cf.html?re=viewwindows under Apache+tomcat+php+mysql+zend Optimizer

3:http://adaishu.blogspot.com/2008/08/apachetomcatstrutsphpmysql-apache.html

Integration of 4:http://www.iteye.com/topic/80667 Apache+tomcat+php+mysql

5:http://www.linuxquestions.org/questions/linux-software-2/example-servlets-not-working-with-mod_ Jk-apache2-webserver-and-tomcat6 ' s-web-container-692783/

Small village Source:http://blog.csdn.net/lu597203933 Welcome to reprint or share, but be sure to declare the source of the article. (Sina Weibo: Small mayor Zack, Welcome to Exchange!) )

WINDOWS+PHP5.5+APACHE2.4+TOMCAT+MOD_JK Configuration

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.