Apache Web lets jsp "move" _ Server

Source: Internet
Author: User
Tags documentation web services tomcat

----JSP is a more commonly used Dynamic Web page production technology, but the Apache itself only supports static web pages, so it needs to be used in conjunction with other specific application services. This article is to introduce a combination of Apache and Tomcat services to support JSP Dynamic Web pages of the latest practical technology, that is, "APACHE/JK" way to support JSP Dynamic Web pages.
----at first, Apache and Tomcat were combined to support JSP Dynamic Web pages through a plugin called "Mod_jserv". This apache/jserv configuration parameter is very complex, inefficient operation, and SSL (a cryptographic transmission mode) support is not ideal, so the Jakarta team has recently developed a "MOD_JK" plug-in, it is a good way to compensate for the shortcomings of Mod_jserv, and can support a variety of Web services outside of Apache.
----about the implementation of this APACHE/JK method, we can go to the website to read the relevant information, this article simply introduces its implementation methods, the principle of the part does not discuss.
----One, installing on UNIX platforms
----This article describes the most common Solaris operating system as an example.
----(i) Application environment
----here, our operating system is Solaris 2.7, and the application is Java 1.2 (assumed to be installed in the/usr/java1.2 directory), Perl 5.005 (assumed to be installed in the/usr/local/bin directory) and gzip (assuming installation in/ Usr/local/bin directory).
----(ii) Download, compilation and installation of software packages
----1. Download Address
----can download the latest Apache source code package apache_1.3.19.tar.gz.
----in the downloadable Tomcat source package jakarta-tomcat-3.2.1-src.tar.gz.
----in the downloadable jakarta-tomcat-3.2.1.tar.gz of a compiled Tomcat application package.
----2. Compiling and installing
----Assume that the packages have been downloaded to the current working directory (such as/HOME/TMP), Apache and Tomcat will be installed in the/home directory. In the current directory we can do the following.
(1) Compiling and installing Apache application services
① Solution Package
$/usr/local/bin/gzip-dc./apache_1.3.19.tar.gz | Tar XF-
② compilation
$ CD apache_1.3.19
$./configure--prefix=/home/apache-1.3.19
--with-perl=/usr/local/bin/perl--enable-module=so
Suppose Perl's interpretation commands are installed in the/usr/local/bin directory,
The Apache service is installed in the/home/apache-1.3.19 directory.
$ make
③ Installation
$ su
# make Install
(2) Compiling and installing MOD_JK plug-ins
① Solution Package
$/USR/LOCAL/BIN/GZIP-DC Jakarta-tomcat-3.2.1-src.tar.gz|tar xf-
② compilation
$ CD jakarta-tomcat-3.2.1-src/src/native/apache1.3
$/home/apache-1.3.19/bin/apxs-o mod_jk.so-dsolaris-i. /jk-i/
usr/java1.2/include-i/usr/java1.2/include/
Solaris-lposix4-c *.c. /jk/*.c
Suppose Java is installed in the/usr/java1.2 directory.
③ Installation
$ su
#/home/apache-1.3.19/bin/apxs-i-a-n JK Mod_jk.so
The installation is successful when the screen displays the following content.
CP mod_jk.so/home/apache-1.3.19/libexec/mod_jk.so
chmod 755/home/apache-
1.3.19/libexec/mod_jk.so
[Activating module ' JK In/home/apache-1.3.19/conf/httpd.conf]
(3) Install Tomcat service
Use Superuser identity to unpack the compiled Tomcat 3.2.1 into the/home directory.
$ su
#/USR/LOCAL/BIN/GZIP-DC jakarta-tomcat-3.2.1.tar.gz|
(Cd/home;tar XF-)
3. Parameter configuration
(1) Configure Apache Service
Use the VI command to open the Apache configuration file httpd.conf.
# cd/home/apache-1.3.19/conf
# VI httpd.conf
Add the following at the end.
Jkworkersfile/home/jakarta-tomcat-3.2.1/conf/workers.properties
Jklogfile/home/apache-1.3.19/logs/mod_jk.log
Note: The log file can be adjusted according to the specific situation.
Jkloglevel warn
Jkmount/*.jsp ajp13
jkmount/servlet/*.jsp ajp13
Note: There are other important but Tomcat-independent references in this profile
parameters (such as port and DocumentRoot, etc.), refer to Apache documentation, which is not covered in this article.
(2) Configure Tomcat service
First, modify the Server.xml file.
This assumes that the root directory of the Web page hosting Apache is/home/htdocs.
# cd/home/jakarta-tomcat-3.2.1/conf
# VI Server.xml
Then, in the Connectors section, embed the following content.
< Connector classname= "Org.apache.tomcat.service.
Pooltcpconnector "> < Parameter name=" handler "
Value= "ORG.APACHE.TOMCAT.SERVICE.CONNECTOR.AJP
13ConnectionHandler "/>
< Parameter name= "port" value= "8009"/>
</connector>
Next, embed the following in the Special WebApps section.
< context path= ""
Docbase= "/home/htdocs"
debug= "0" >
</context>
Further modify the Workers.properties file.
# VI Workers.properties
...
workers.tomcat_home=/home/jakarta-tomcat-3.2.1
...
workers.java_home=/usr/java1.2
...
ps=/
...
Then, modify Tomcat startup and shutdown command files.
# CD ... /bin
# VI startup.sh
Then embed the following in front of the "Basedir= ' dirname $" statement.
Path=/usr/java1.2/bin: $PATH:.
java_home=/usr/java1.2
tomcat_home=/home/jakarta-tomcat-3.2.1
Export PATH java_home tomcat_home
# VI shutdown.sh
Finally, embed the following before the "Basedir= ' dirname $" statement.
Path=/usr/java1.2/bin: $PATH:.
java_home=/usr/java1.2
tomcat_home=/home/jakarta-tomcat-3.2.1
Export PATH java_home tomcat_home
4. Test
Start Apache and Tomcat, respectively.
#/home/apache-1.3.19/bin/apachectl Start
#/home/jakarta-tomcat-3.2.1/bin/startup.sh
Then, edit the simple. JSP test file.
# vi/home/apache/-1.3.19/htdocs/test.jsp
< html>
< head>
< title> This is a JSP test file!
</title>
< body>
<% Out.print ("This is a JSP test File!n"); %>
</body>
Finally, make a web browsing.
----Open the browser to access the. jsp file: http://host name (or IP address)/test.jsp. If the screen display such as the figure shown in the content, indicating that the operation is normal, at this time, you can normally run JSP Dynamic Web page files.

Install on the Windows nt/2000 platform
----This article takes the Windows 2000 platform for example.
----(i) Application environment
The----operating system uses Windows 2000, the application environment is Java 1.2.2 (assumed to be installed on c:jdk-1.2.2) and WinZip.
----(ii) Download and installation of software packages
----the installation on Windows NT2000 is simpler, the application software does not have to be recompiled, only downloaded packages that have been compiled on the site.
----1. Download Address
----The latest Apache package Apache_1.3.19-windows32-no_src-r2.msi that can be downloaded and compiled.
----available in downloadable mod_jk.zip.
----available in downloadable jakarta-tomcat-3.2.1.zip.
----2. Installation
----First, double-click "Apache_1.3.19-windows32-no_src-r2.msi" to install the Apache service.
----then unzip "Mod_jk.zip" to the "modules" subdirectory of the Apache service and, finally, extract "Jakarta-tomcat-3.2.1.zip" to the C: directory.
----3. Parameter configuration
----(1) Modify the configuration file for the Apache service httpd.conf
----NOTE: This article only involves Tomcat-related parameters, and the rest of the parameter settings refer to Apache documentation.
----First click "Start" * "program" * "Apache httpd Server" * "Configure Apache Server" * "Edit Configuration".
----Then, embed the following in the "Dynamic Shared Object (DSO) Support" section.
LoadModule Jk_module Modules/mod_jk.dll
Finally, add the following at the end of the file.
Jkworkersfile c:jakarta-tomcat-3.2.1confworkers.properties
Jklogfile C:jakarta-tomcat-3.2.1logsmod_jk.log
Jkloglevel warn
Jkmount/*.jsp ajp13
jkmount/servlet/* ajp13
(2) Configure Tomcat service
----Adjust the parameters of the Server.xml and workers.properties files, the reader can refer to the UNIX section corresponding paragraphs. But readers should note that for different levels of directories, UNIX is separated by "/" and Windows is separated by "".
----Edit the Startup.bat and Shutdown.bat files separately, embed the following in the 2nd line of the file.
Set tomcat_home=c:jakarta-tomcat-3.2.1
Set java_home=c:jdk1.2.2
Set Path=c:jdk1.2.2bin;.; %PATH%.
4. Test
Test with the corresponding paragraphs in the UNIX section.
----This article simply introduces the configuration and usage of APACHE/JK methods, and there are many parameters in Tomcat's configuration file (such as Server.xml) that can be adjusted according to the actual situation, which is not much described here. Interested readers can refer to the information in the configuration file or the relevant information on the website for further adjustment and testing.
----(Shangpeng author Address: No. 58th Sanlihe Road, Xicheng District, Beijing, China through the network company, 100045)
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.