Consolidating apache+tomcat+php under Windows XP

Source: Internet
Author: User

This article is mainly from the installation of JK plug-ins to explain the integration of Apache+tomcat.

Previously, when doing project testing on this machine, Tomcat was used alone, rather than the same configuration as Apache+tomcat on the server. But the benefits of integrating Apache+tomcat are well known. Why don't we give it a try?

In fact, the first time is not to integrate Apache and Tomcat integration, because before on my PC is not installed Apache, a chance--the company needs to help others to maintain a project written in PHP, so in order to test PHP, so I installed an Apache on the PC , and install PHP (if you have friends who need to know apache+php installation can see this article: Apache+php+mysql installation and configuration diagram under Windows. If this article is deleted, you can email to me-- [email protected]).

Well, let's go to the beginning of our integration.

Since the installation of Apache and Tomcat articles on the internet a lot of search, so I do not need to be here wordy. Let's start from there.

One of the most important steps in integrating Apache and Tomcat is to install the "connector"--JK plugin for Apache and Tomcat (I don't know if my description is reasonable or not, and if there are any mistakes, please point them out). JK and JK and JK2,JK2 official documents said JK2 is JK's upgrade version, and enhanced functionality, but JK's official documents said the project does not support JK2, but to re-develop JK, and on the Internet is difficult to JK2, Apache's official website is only JK. If you want to download it here: http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/to download a suitable version.

To install JK Plugin steps:

1, download JK. I downloaded the mod_jk-1.2.26-httpd-2.2.4.so, download the good, copy the mod_jk-2.26-httpd-2.2.4.so to the Apache/modules folder;

2, create two configuration files under apache/conf: Mod_jk.conf and Workers.properties;

3, first edit the workers.properties, this configuration file is to configure some of Tomcat, the contents are as follows:

# Defining a worker named Tomcat1 and of type ajp13
Worker.list=tomcat1

# Set Properties for TOMCAT1
Worker.tomcat1.type=ajp13
Worker.tomcat1.host=localhost
worker.tomcat1.port=8009
Worker.tomcat1.lbfactor=50
#worker. tomcat1.cachesize=1
#worker. tomcat1.cache_timeout=600
Worker.tomcat1.socket_keepalive=1
worker.tomcat1.socket_timeout=300
# Define A ' jkstatus ' worker using status

3.1, of course, can also put workers.properties in the tomcat/conf folder, then JK configuration file mod_jk.conf will be slightly modified:

# indicate the location of the working file Workers.properties required for the MOD_JK module to work
Jkworkersfile "C:/Program Files/apache software foundation/tomcat 5.5/conf/workers.properties" (The absolute path of workers.properties hard disk is given in JK's configuration file)

4, re-edit mod_jk.conf, this is JK's configuration file, the contents are as follows:

#指出mod_jk模块工作所需要的工作文件workers. Location of properties
Jkworkersfile "Conf/workers.properties"
# Where to put JK logs
Jklogfile "Logs/mod_jk.log"
# Set the JK log level [Debug/error/info]
Jkloglevel Info
# Select the log format
Jklogstampformat "[%a%b%d%h:%m:%s%Y]"
# jkoptions indicate to send SSL KEY SIZE,
Jkoptions +forwardkeysize +forwarduricompat-forwarddirectories
# Jkrequestlogformat Set the request format
Jkrequestlogformat "%w%V%T"
#将所有servlet and JSP requests are sent to Tomcat via AJP13 's protocol, allowing Tomcat to handle
Jkmount/*.jsp TOMCAT1
jkmount/servlet/* TOMCAT1
jkmount/application/* TOMCAT1
Jkmount/*.do TOMCAT1
Jkmount/*servlet TOMCAT1
Jkmount/*.action TOMCAT1

5, modify the apache/conf/httpd.conf file, add the following code:

LoadModule Jk_module modules/mod_jk.so

Include conf/mod_jk.conf

6, will apache/conf/httpd.conf modify the root directory of Apache: DocumentRoot "D:/workspace/tfttc/webroot"

After a few steps above, it should have been integrated successfully, if you visit http://localhost should be accessible, and if you visit http://localhost/test.jsp should also be normal, but I still have a problem. Always prompt for errors when I launch Apache, view log file discovery: Httpd.exe:Syntax error on line 129 of F:/program Files/apache software foundation/ Apache2.2/conf/httpd.conf:cannot load F:/program files/apache software foundation/apache2.2/modules/mod_jk.so into Server:.

So I can't do it. On the Internet to check the error, are said to be JK version of the problem, but I also changed a lot of versions, or useless. So I shut down and slept. Results the next morning when the start of Apache, no error, so I visit http://localhost found can access, start Tomcat, and then visit http://localhost/test.jsp Discovery can also be normal access. So I am confused, is not the integration of Apache and Tomcat after the restart of the computer? Haha, if your situation is similar to mine, may wish to restart the computer to see, perhaps will "Vista".

Originally, I also want to integrate Apache, Tomcat, PHP together, so that the server can support both JSP and PHP two Web technology, it would have thought how complicated and tortuous, but, when I did the above work, found that my server has been able to support both PHP and JSP support. I'm so happy.

My installation order is: Apache, PHP, MySQL, JDK, Tomcat, Jk. By following these steps, your server can support both PHP and JSP.

In fact, these steps can be divided into three parts: 1, first let your server support PHP, then you have to install Apache and PHP, installation and configuration after the completion, you must test to let your server support PHP. (If you're using a database, install MySQL as well) 2, install and configure the JDK and Tomcat so that your tomcat can normally support JSP access. 3, installation and configuration JK, this is a key step, because after the first two parts of the work, your server has been able to support PHP and JSP alone, and this part of the--JK plug-in for the installation of your Apache and Tomcat to work together. After the success, your server can support both PHP and JSP, such as you can access the page at the same time: http://localhost, http://localhost/test.php, http://localhost/test.jsp.

But the above steps are simple to say, but to be successful, its road is tortuous, the process is sad, only we know, but, believe in themselves, nothing is impossible.

Transferred from: http://blog.sina.com.cn/s/blog_497300720100a6ek.html

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.