How to integrate Apache and tomcat in Windows

Source: Internet
Author: User

Here we will first discuss the benefits of integration,

(1) Apache has many mod which provide a wide range of web functions. For example, it can solve the problem that multiple domain names correspond to the same IP address, making up for the disadvantages of Tomcat's fewer web server functions.

(2) Apache is more responsive than other Web servers.

(3) Apache is faster in parsing static pages.

(4) Apache also performs well in terms of stability

(5) tomcat has a servlet container that supports Servlet and JSP and can generate dynamic pages well.

(6) Tomcat's latest version 7.0 also supports websocket, a new feature in HTML5, which makes chatting easier and faster.

(7) Tomcat's support for static pages is not as efficient as Apache, and its stability is not as good as Apache. However, the combination of the two can complement each other.

How to integrate the data?

Required software:

Tomcat 7.0: http://tomcat.apache.org/download-70.cgi

JDK 7: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html

Apache 2.2: http://httpd.apache.org/download.cgi#apache22

Mod_jk: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/

Note: The mod_jk version must correspond to the Apache version.

1. Install JDK (I installed JDK in D: \ Program Files \ Java)

2. install Tomcat (I installed it in D: \ Program Files \ Apache Software Foundation \ Tomcat 7.0)

3. install Apache (I installed it on D: \ apache2.2)

During installation,

Servername 127.0.0.1

4,

Apache configuration

Open httpd. conf in conf under the Apache installation directory,

Add the following content:

Loadmodule jk_module modules/mod_jk.so
# The mod_jk file here is the file you downloaded
Jkworkersfile "D:/program files/Apache Software Foundation/tomcat 7.0/CONF/workers. properties"
# Specify the Tomcat Listener Configuration File address
Jklogfile "D:/program files/Apache Software Foundation/tomcat 7.0/logs/mod_jk2.log"
# Specify the log storage location
Jkloglevel info

# Setting up a VM
<Virtualhost localhost>

Serveradmin localhost
DocumentRoot "D:/program files/Apache Software Foundation/tomcat 7.0/webapps"
# The path of your site project should be the same as the directory settings in Tomcat
Servername localhost
Directoryindex index.html index.htm index. jsp
Errorlog logs/shsc-error_log.txt
Customlog logs/shsc-access_log.txt common
Jkmount/servlet/* ajp13
# Apache supports servlet transfer for Tomcat Parsing
Jkmount/*. jsp ajp13
# Apache supports JSP transmission for Tomcat Parsing
Jkmount/*. Action ajp13
# Apache supports transfer of. Action for Tomcat Parsing
</Virtualhost>

No workers. properties in the conf file under tomcat. Create a file,

Add the following content:

Workers. tomcat_home = D: \ Program Files \ Apache Software Foundation \ Tomcat 7.0
# Let the mod_jk module know the location of Tomcat
Workers. java_home = D: \ Program Files \ Java \ jre7
# Let the mod_jk module know the location of the JRE
PS = \
Worker. List = ajp13
# Module version
Worker. ajp13.port = 8009
# Working port. Do not modify it if it is not occupied
Worker. ajp13.host = localhost
# Modify the local machine if the above Apache host is not localhost
Worker. ajp13.type = ajp13
# Type
Worker. ajp13.lbfactor = 1
# Number of proxies, no need to modify

In addition, you can always observe whether the configuration is correct during the configuration process,

In Windows, open cmd, enter the bin directory in Apache, and run httpd.exe-t,

If syntax is OK, the configuration syntax is correct.

 

Then watch the http: // localhost/and http: // localhost: 8080/pages. If the page is the same, the integration is successful.

Of course, if you find it, it doesn't work.

,

Then, set httpd. conf's directory,

Changed:

<Directory/>
Options followsymlinks
AllowOverride none
### Order deny, allow
### Deny from all
Order allow, deny
Allow from all
Satisfy all
</Directory>

You can.

References:

Http://www.zhuoda.org/lunzi/96705.html

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.