Integration and Integration of Apache and Tomcat

xiaoxiao2021-03-06  21

I. First of all, I still quote a post of others, then do some instructions, and I will also ask you to correct it. II. Use Tomcat to do JSP servers alone, there will be problems in work efficiency, and the maximum number of concurrent connections that can withstand can also limit; Test, Tomcat is in the state of "zombie" when concurrent connection The subsequent request connection lost response. So now I have some "integration" solution: the HTML is clearly divided into labor, so that Tomcat only processes the JSP section, and other Web Server processing by Apache, IIS, which greatly saves Tomcat limited Work "thread". Of course, these J2EE servers such as IBM WebSphere, BEA WebLogic, JBoss will be a better solution, but only the application EJB will play the powerful features of these J2EE servers. So here, recommend Apache Tomcat's "gold combination". Find some information on the Internet, then do your own experiment, tossing for nearly one hour, finally got! The specific process is summarized as follows, I hope to help everyone: my operating environment: Windows2k Server SP4 J2SDK1.42 Apache2.049 Tomcat5.019 SQL Server2k ** Preparation Software: 1, Apache 2.0.49 2 Tomcat 5.0.19 3, JK2 connector (MOD_JK2.SO) ** Start installing: (The installation path here is optional, as long as you regard your actual situation is slightly modified) Apache is installed in H: / Apache / Under apache2, listening port 80; Tomcat is under H: /Apache/tomcat5.0, listening to port 8080; both are installed in Windows NT services.

Copy mod_jk2.so into the h: / apache / apache2 / modules directory: 1. Edit the h: /apache/apache2/conf/httpd.conf file, add: loadingModule JK2_Module Modules / Mod_jk2.so 2 Change AddDefaultCharset ISO-8859-1 to AddDefaultCharset GB2312 Automatically supports Chinese display; 3. Add: (This configuration can be modified according to your actual situation) ServerAdmin Pentium4xeon@etang.com DocumentRoot "H: /Apache/Tomcat5.0/webapps/ROOT" ServerName www.sdg.com ErrorLog logs / sdg.com-error_log CustomLog logs / sdg.com-access_log common * * Write the WORKERS2.PROPERTIES file and join the H: / apache / apache2 / conf directory, the content is as follows: [SHM] file = $ {serverroot} /logs/shm.file size = 1048576 #the socket channel: localhost: 8009] Port = 8009 Host = 127.0.0.1 #define the worker [AJP13: localhost: 8009] channel: localhost: 8009 #uri mapping [URI: / *. Jsp] worker = ajp13: localhost: 8009 ** Since Tomcat 5.019 has a JK2.Properties file, you don't have to write it yourself here. (Perhaps this is one of the benefits of high versions * ^ _ ^ *) ** Writing a normal HTML file (index.html) with a JSP file (Test.jsp), put it in h: /apore/tomcat5.0 / WebApps / root; Now it is best to restart your computer. After restarting, start Apache and Tomcat, http://www.sdg.com is the same as http://www.sdg.com:8080 --- displayed index.html; now you can test it Test.jsp, http://www.sdg.com/test.jsp, how, take it smoothly? ** Test the Tomcat connection pool section below, copy all files (HTML JSP JAVABEAN Servlet) to h: /apache/tomcat5.0/webapps/root, configure Tomcat's server.xml file, add a connection pool . In my, after testing, all functional parts can work.

Download: MOD_JK2.SO ***************************************************************** * 1. If your home page is a JSP page, you also need to configure one: DirectoryIndex index.html index.html.var index.jsp plus index.jsp, you can * ^ _ ^ * 2. Warning: --- -------- ** After integration, the work has been normal, but accidentally opened the apache 's error.log file, was scared for a cold sweat ~~~~ There is more mistakes, there is a tonal: No Such Channel Port: localhost: 8019 ..... AJP13XX FAILED! Take a closer look at the worker2.properties file, find a setting inside: [AJP13: localhost: 8019] channel = channel.socket: localhost: 8009 Error finger The 8019 port is this ~ Immediately change 8019 to 8009 ~ There is no such problem now ~ It seems that the online information is not necessarily the most accurate ... (may be a pen error ~~~ : P ** - thus gives you inconvenience, I apologize! 3. I find a "small problem" on a configuration ---- Virtual host has a configuration: DocumentRoot item, if you follow DocumentRoot H: /apache/tomcat5.0/webapps/root configuration, the host can work normally, but if you open the logs / sdg.com-error_log file, you will find a line error message: ** Warning: "h : //Apache/tomcat5.0/WebApps/root "Doesn't Exist! Attempt, if it is changed: DocumentRoot" h: /apache/tomcat5.0/webapps/root "does not have any warning information In the error_log file ~ I'm your own configuration and important parameter description (WinXP Tomcat5.0.14 apache2.0.52): Tomcat installation directory: f: / tomcat, there is an application item in WebApps Yedongshu Apache installation directory: f: / Apache2052 My workers2.properties :[shm]file= $ {srverroot }/lo gs / shm.filesize = 1048576 # The socket channel [channel.socket: localhost: 8009] port = 8009host = 127.0.0.1 # define the worker [ajp13: localhost: 8009] channel = channel.socket: localhost: 8009 # Map the Tomcat Examples WebApp To The Web Server Uri Space [Uri: / YedongDShu / Web-INF / *] [URI: / *. JSP] INFO = Map The Whole WebApp About Workers2.Properties: [Uri: / Yedongdshu / Web- INF / *] [URI: / *. Jsp] When encountering JavaBean, servlet, JSP, apache is unified to Tomcat Processing.

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

New Post(0)