Also talk about the configuration of Win2000 Tomcat & Apache

zhaozj2021-02-12  152

Author: qlampskyface

Contact your author: xiaozuidaizhi@sina.com

Before configuring, you have to define two points. 1. Why is you configured? 2. Why is it so configured?

1. Why is you configured? In fact, as Tomcat, after the installation is complete, it has been used as a website server. For many users, it is enough, so if your purpose is not a configuration, but use, then you are likely to don't need to look. However, Tomcat is separate as a website server, there are some defects, such as

1. Tomcat Treatment Static page No apache fast 2. Tomcat is not as easy to configure 3. Tomcat No apache stabilizes strong 4. Apache supports CGI scripts and API, Perl, PHP, etc.

It is because of the above reason, we integrate both when we are in some cases. I reiterate again ----- Tomcat Apache's biggest benefit is to let them all their duties: Apache is responsible for analyzing static pages, Tomcat is responsible for processing servlet / jsp.

2. Why is it so configured? You are likely to have also heard of WebLogic, WebSphere, and JBuilder integration cases. These cases can also configure the website server, JBuilder, WebLogic ... These tools are not good, but these tools have a fatal weakness, that is --- They is not free! And Tomcat Apache is Free, and for individuals, as well as small and medium-sized companies, Tomcat Apache is already enough, so I don't have to say it below.

Ok, let's start configuring our website server!

Let me talk about some installation files we need.

J2SDK (I am 1.4.2), Apache Http Server (I am 2.0.43), Tomcat (I am 4.1.29), mod_jk2-2.0.43.dll. Why do you want to mention the software version? It is because there is a slight difference between the possible configuration between the different versions, but do not only the version of the version, when the version is different, I don't know what to do. In fact, as long as I understand the reason, I don't leave it. You don't have to worry about the version.

Apache http server2.0: (47 or 48 can you find for 2.0.43 can also be found)

http://www.apache.org/dist/httpd/binaries/win32/apache_2.0.43-win32- x86-no_ssl.exe

Tomcat:

Http://www.apache.org/dist/jakarta/tomcat-4/v4.1.29/bin/jakarta-tomcat-4.1.29.exe

MOD_JK2-2.0.43.dll: (Under the down to decompress)

Http://www.apache.org/dist/jakarta/tomcat-connectors/jk2/binaries/win32/jakarta-tomcat-connectors-jk2.0.2-win32-apache2.0.43.zip

We should configure it according to the following five steps, it will feel very clear. 1. Installed. 2. Set the environment variable. 3. Integration. 4. Add. 5. Test. First, install it.

It should be noted that please install in the order of J2SDK, Apache, Tomcat. This is because we are configured to configure Tomcat into an in-Process component of Apache. When the page is handled, Apache first gets this page, then analyzes the page. If this page is just a static page, then Apache will handle itself, do not hand it over to Tomcat, but if the page is a non-static page In order to hand over to Tomcat to the station, hand it over to Apache after processing. That's why you have to install the Apache after installing Tomcat. Furthermore, you need you to fill in 1. Domain when you install Apache

2. Server name

3.Email

It is necessary to fill in (such as 127.0.0.1, etc.)

Second, set environment variables.

A total of five. 1.java_home 2.path 3.classpath 4.catalina_home 5.tomcat_home About the first three configurations I don't say much, is the setting of JDK. Where you want to put the Tools.jar and Dt.jar of the JDK's lib directory in Classpath. The configurations of 4th and 5th items are the same: all Tomcat installation paths (such as my Tomcat installed in D: / Program Files / Apache Group / Tomcat 4.1)

Third, integration.

Copy the above MOD_JK2-2.0.43.dll into the modules folder in the Apache2 directory. The integration operation is very simple, but it is significant, relying on this file, the Apache and Tomcat can be used. Pay special attention to this link is that there are two mod_jk files. One is the JK2 we used. One is JK (such as MOD_JK_1.2.5_2.0.47.dll), this is specially paying special attention when the initial configuration, Don't look wrong, because different file configuration methods are completely different, remember to remember!

Fourth, add it.

In this link, two files in two places need to be added. The first is the modification of the httpd.conf profile in the confoc folder in the Apache2 installation directory; the second is the property file named Workers2.properties in the CONF folder in the Tomcat installation directory. Since both are the confed directory, don't make a mistake.

First, modify the httpd.conf file:

Open httpd.conf file, find DirectoryIndex, add index.jsp after index.html index.html.var, pay attention to separated from spaces. This purpose is to let Index.jsp use files that open formats by default. Add the following in HTTPD.CONF.

LoadModule jk2_module modules / mod_jk2-2.0.43.dll ServerAdmin webmaster @ djb DocumentRoot "D: / Program Files / Apache Group / Tomcat 4.1 / webapps / ROOT" ServerName djb wherein LoadModule is loaded with the Apache Tomcat integration module mod_jk ..., In this way, when Apache encounters the JSP file, it will be handled in Tomcat in the background. WebMaster @ DJB is your mail address. When the server has a problem, it is displayed on the error page, which is convenient for others to contact you. DocumentRoot is the entrance of the website, the total path, this must be consistent with the entry of Tomcat, here I let it point to the default page of Tomcat. It should be noted here that if there is no space in your Tomcat path, you don't have to use "" to take the path, but if you have space, there must be "" " ServerName is the machine name where Apache is installed. Here, especially note that the backslash / must be all replaced on your path to /, remember to remember the second place, add a workers2.properties file. New files under the CONF folder under the Tomcat installation directory, named Workers2.properties. Add the following in which: # Define the communication channel [channel.socket: localhost: 8009] info = Ajp13 forwarding over socket tomcatId = localhost: 8009 # Map All webapp to the Web server uri space [uri: / *] info = Map The Whole WebApp

Among them, the row starting with # is illustrative. Here is done to define the ACHE and Tomcat's AC port (8009 port) and protocol (AJP13), and URI. The URI section is not necessarily in accordance with the above definition, you can set it to yourself. For example, when you only want to open the Sub-path Examples, you can define the following: # Map the Tomcat Examples WebApp to the Web Server Uri Space [URI: / Examples / *] info = map the whole webapp.

V. Test.

Start Apache and Tomcat, then open the browser, type http: // localhost / if you see a kitten metamorphosis, then congratulations, you have successful, if you want to verify, you Enter http: // localhost: 8080 / if there is a one-mode allergic kitten looks at you, you can determine.

To say a few words, in general, when we develop procedures, we need to restart, debug, interrupt frequently. If you are developing on the combination of Apache Tomcat, you will find it very troublesome. At this time, it is suitable to use Tomcat, which can also be parsed directly to the static page ... so we can do not integrate Apache Tomcat when we develop ... We can release it to an Apache after the program debugging is successful. Tomcat's machine. Also, there are two modes of the server: debug mode and normal mode, if you make your application in debug mode, efficiency is also very low. Therefore, in general, when we write the program, it is done on a separate Tomcat. When it is released, it will be released on Tomcat Apache.

Finally, if you are unfortunate, please ask you: 1. Check if the version is consistent; 2. If the same, please check if your operation is correct, such as MOD_JK2 or JK ..., backslash problem; 3. If Inconsistent, please search for other articles and refer to this article. (This article is definitely worth reference!)

转载请注明原文地址:https://www.9cbs.com/read-6175.html

New Post(0)