Windows + php5.5 + apache2.4 + tomcat + mod_jk configuration, php5.5apache2.4

Source: Internet
Author: User
Tags apache tomcat

Windows + php5.5 + apache2.4 + tomcat + mod_jk configuration, php5.5apache2.4

Cause:

Generally, apache runs port 80. For example, the It works page is displayed when localhost: 80 is run after apache is started. If this parameter is set to 80, the default setting is displayed. When tomcat is started, the default port is port 8080. You need to add port 8080 after localhost. However, this is not professional, and the domain name also has port. Therefore, we can use the tomcat server. modify xml to 80. But now the problem arises. When a project written in php is using apache as a service, how can we simultaneously run projects written in php and those written in jsp, the plug-in mod_jk is needed here. It can put the url to be accessed by jsp into tomcat for processing by tomcat.

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

I. configuration of apache2.4, php5.5, and mysql

This part I do not want to talk more can refer to: http://jingyan.baidu.com/article/9faa723152c5d6473d28cb47.html

 

Ii. mod_jk Configuration

Download the mod_jk.so file corresponding to the apache version from the official website and put it under the modules directory of apache.

Create two files under the conf directory: 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 jsp project name)

 

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: In JkOptionszhong, ForwardURICompatUnparsed is not ForwardURICompat. Otherwise, garbled characters will appear.

Add the following content to httpd. conf In the conf directory of apache:

Include conf/mod_jk.conf

 

Iii. tomcat configuration

Rename the appBase in server. xml in tomcat to the location where your apache configuration project is stored.

In this way, when you access the jsp project in the browser, apache will automatically ship your access to tomcat for processing, in this way, php and jsp can be accessed without the need to write a port number.

Note: The reference document also provides virtualHost configuration. This may be done when tomcat's port number cannot be accessed from the internet. I have not studied it here, but it works normally.

 

References:

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 = apache + tomcat + php + mysql + zend optimizer in viewwindows

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

4: http://www.iteye.com/topic/80667 Apache + Tomcat + Php + Mysql Integration

5: bytes/

Author: small village chief source: http://blog.csdn.net/lu597203933 welcome to reprint or share, but please be sure to declare the source of the article. (Sina Weibo: small village chief zack. Thank you !)


How does one configure Apache Tomcat 5512 in windows?

Configuration

Right-click my computer on the desktop)

Advanced

Environment Variable

Go to "system variables" ---> "new"

Enter JAVA_HOME in the variable name and F: \ JDK13 in the variable value, and then click OK;

Go to "system variables" ---> "new"

Enter TOMCAT_HOME in the variable name, F: \ tomcat32b4 in the variable value, and then confirm;

Apache tomcat configuration

The apache installation directory is APACHE_HOME.
Tomcat installation directory is TOMCAT_HOME (to be set to environment variables)
The jdk installation directory is JAVA_HOME (to be set to environment variables)
1. install apache: (if the installation directory is APACHE_HOME, replace it with your actual installation)
After installation, modify the following six parts of APACHE_HOME/CONF/httpd. conf:
1) Port 8080 or 80
2) ServerName localhost
3) DocumentRoot "e:/www" (it is better to create a directory as the document root for ease of publishing)
4) change the original <Directory "APACHE_HOME/htdocs">
<Directory "e:/www">
5) add index. jsp as the default primary index file
<IfModule mod_dir.c>
DirectoryIndex index.html index. jsp
</IfModule>
6) This is the most critical step.
# Tomcat support
Include TOMCAT_HOME/conf/mod_jk.conf-auto
Only this sentence is enough, don't listen to those idiots, plus what tomcat-apache.conf, that's useless.
Copy mod_jk.dll to the APACHE_HOME/module Directory.
This will ignore apache and set tomcat.
Steps:
Decompress tomcat and copy its real directory jarakar-tomcat to the directory named TOMCAT_HOME.
Modify server. xml in the conf directory under TOMCAT_HOME
1) if you do not want to view the TOMCAT startup information, do this:
<Logger name = "tc_log"
Path = "logs/tomcat. log"
VerbosityLevel = "INFORMATION"
/>
Add a PATH = "logs/tomcat. log ".
2) Change tomcat to 8081. Generally, the www Service is on 80 or 8080:
<! -- Normal HTTP -->
<Connector className = "org. apache. tomcat. service. PoolTcpConnector">
<Parameter name = "handler"
Value = "org. apache. tomcat. service. http. HttpConnectionHandler"/>
<Parameter name = "port" value = "8081"/>
</Connector>
3) added support for APJ13 Protocol
<! -- Apache AJP13 support. This is also used to shut down tomcat. -->
<Connector className = "org. apache. tomcat. service. PoolTcp... full text>

Related Article

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.