Getting started with Apache and Tomcat

zhaozj2021-02-08  230

Getting started with Apache and Tomcat

Author: cherami

Email: cherami@163.net

Hereinafter, refer to Tomcat's mod_jk-howto.html and its own actual configuration experience, if you cannot configure it in this document, please refer to this document. Step step. My Tomcat version is 3.3A, and the document also comes with this version.

1. Get MOK_JK: http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/, this directory has a compiled binary mod_jk for different platforms, for the Linux platform, LINUX / I386 directory (MOD_JK.SO), for the Windows system located in Win32 / I386 (MOD_JK.DLL) (you can also compile the required module according to the Tomcat's own document, please refer to Tomcat Document MOD_JK-HOWTO.HTML)

2. Copy the resulting mod_jk to the corresponding directory of Apache, for the Linux / UNIX platform for the libexec directory of Apache, for Windows, for the modules directory

3. Modify the httpd.conf file under Apache, if you use MOD_JSERV, then remove it, then in the final increase of the file as follows: include Tomcat_home / conf / auto / mod_jk.conf, where Tomcat_Home uses your own The actual path of the system is replaced, for Windows, one example is include D: /jakarta-tomcat/conf/Auto/mod_jk.conf, is include / usr / local / jakarta-tomcat / conf / auto / mod_jk for UNIX / Linux. CONF

4. Modify the start file of Tomcat, make it an auto / mod_jk.conf file, method is, for Windows, modify the startup.bat under the bin directory, 3% 2% 3% 4% of the last line of Start% 1% 2% 3% 4% 5% 6% 7% 8% 9 changed to Start JKCONF% 1% 2% 3% 4% 5% 6% 7% 8% 9, then run startup.bat, (the process is very fast, it will automatically exit after running The operational waiting state of non-normal startup will generate a file tomcat_home / conf / auto / mod_jk.conf, and then restore the startup.bat, for UNIX / Linux, the $ basedIr / Tomcat in Startup.sh .sh Start $ @ Modified to $ BASEDIR / TOMCAT.SH Start Jkconf $ @, run startup.sh, will also generate tomcat_home / conf / auto / mod_jk.conf, and the situation is similar to the Windows platform.

5. Restart Apache, start Tomcat, and the basic configuration of the Apache_Tomcat completed.

Note: In this case, the content of Apache can serve only the existing apps in Tomcat's WebApps directory when you perform the fourth step. If you add your app to Tomcat's WebApps directory, then you only pass by Apache. Access to the original application, you can add port 8080 to access, to resolve this issue, one method is to perform 4, 5 steps again, or you can according to Tomcat_home / conf / auto / mod_jk.conf Add your new application. Another way to test the in-depth test is to replace all JKMount lines in MOK_JK.CONF: JKMount / AJP13

JKMOUNT / * AJP13

The result of this is actually possible to give all the applications to Tomcat, and even the Apache's primary service directory has also become Tomcat's main web service directory (WebApps), adding applications to Tomcat will not have to make any modifications. Just restart Tomcat, as for the service of the static web page is Apache or Tomcat is not clear, and the additional configuration of Apache is therefore affected. In addition, it is necessary to note that if there is an underline in the name of the application in the WebApps directory of Tomcat, the generated application name will change, such as the contents of the directory Test_underline under WebApps, then you should pass http: // localhost / test / underline Access rather than http: // localhost / test_underline, this you can view the resulting MOK_JK.CONF, this is because Tomcat automatically replaces the underscore in the application directory to /, which can be obtained by starting information from Tomcat.

This article is a basic configuration, if you need to get a more flexible configuration, refer to the configuration instructions for Apache and Tomcat.

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

New Post(0)