Integrate Tomcat Server and Apache Server

zhaozj2021-02-16  80

-------------------------------------------------- ------------- Win2000 Professional System Integrated Tomcat Server and Apache Server ZGTT (Original) Keyword Integration, Virtual Directory This article Using Software Download Address (1) Windows 2000 Service Pack 3.exe Download Address: http://download.microsoft.com/download/WIN2000PLATFORM/SP3.EXE (2) J2SDK-1_4_1_02-windows-i586.exe download address: http: //java.sun. http:: //apache.linuxforum com / webapps / download / Redirect / 32167382 / 5847479377282807053505607246086069333228071972022813600060132859339008063305596058473206-3865 / j2sdk-1_4_1_02-windows-i586.exe (3) jakarta-tomcat-4.1.18-LE-jdk14.exe address to download. Net / dist / jakarta / tomcat-4 / binaries / Tomcat-4.1.18-le-jdk14.exe (4) apache_2.0.44-win32-x86-no_ssl.msi download address: http://apache.linuxForum.net/ Dist / httpd / binaries / win32 / apache_2.0.44-win32-x86-no_ssl.msi (5) MOD_JK2-2.0.43.dll Download address: http://jakarta.apache.org/builds/jakarta-tomcat-connectors/ JK2 / Release / V2.0.1 / bin / win32 / mod_jk2-2.0.43.dll Preface: Use mod_jk2 to integrate Tomcat service Worker and Apache servers, simple. First, after installing Windows 2000 Professional After installation of Windows 2000 Professional, it is highly recommended to install Windows 2000 Service Pack 3 because the latest JDK is installed in Windows 2000, you need to install Windows 2000 Service Pack 3 in advance. Second, install the JAVA JDK (J2SDK-1_4_1_02-Windows-i586.exe) follow the default directory: c: /j2sdk1.4.1_02, the system variable needs to be set after the JDK installation is completed. Right-click "My Computer" on the desktop, click "Properties", select "Advanced", click "System Variable", do the following settings in "System Variable": (1) Find PATH, click "Edit", only The last added in "Variable Value": C: /J2SDK1.4.1_02/bin; then "OK".

(2) Click "New", enter in "Variable Name": ClassPath Enter:.; C: /J2SDK1.4.1_02/lib/tools.jar; then click "OK", pay attention to the previous one Point, it represents the current directory, after the directory, you can go to any directory to perform the Java program that requires a certain class in the directory. Third, install Tomcat (jakarta-tomcat-4.1.18-le-jdk14.exe) only change the installation directory, set to C: / Tomcat 4.1, the rest is the default, password itself setting itself. After the Tomcat installation is complete, you also need to set the system variable, right-click "My Computer" on the desktop, click "Properties", select "Advanced", click "System Variable", do the following settings in "System Variable": (1) Click "New", entered in "Variable Name": Java_home Enter: C: /J2SDK1.4.1_02 and save it in "OK" in "Variable Name". (2) Point "New", enter: Tomcat_home in "Variable Name" Enter: C: / Tomcat 4.1 and click "OK" to save. Fourth, Test Tomcat (1) Start Tomcat Server, "Start Tomcat" in "Start" -> "Programs" -> "Apache Tomcat 4.1" (A "Command Prompt" window, do not turn off it), Tomcat server I started to run. (2) Enter http: // localhost: 8080 / after IE, see the top of Tomcat (with only a kitten above) indicates successful installation. (3) Close the Tomcat server, click "Stop Tomcat" in "Start" -> "Programs" -> "Apache Tomcat 4.1" command prompts

The window is automatically turned off), the Tomcat server stops running. 5. Establishing the virtual directory Tomcat server has the default virtual directory (C: / Tomcat 4.1 / webapps), but we generally put it in the self-built folder when we develop a website. Next, if you want to put it

The folder turns into a virtual directory known to Tomcat, and we need yourself. Now introduce the method of configuring the Tomcat virtual directory: (1) Establish the zgtt folder in the D disk, then make a simple JSP file (for test) under the folder, named index.jsp, the content is as follows: hello </ title> </ head> <body> <% out.println ("Hello World!");%> </ Body> </ html> (2) Close Tomcat server (method See "IV, Test Tomcat" (3) description). (3) Under the C discharge, open the "Tomcat 4.1" folder, then open the subdirectory "conf" find the "server.xml" file, open it with Notepad and find "</ host>", in </ host > Previous Add this code: <context path = "/ zgtt" DOCBASE = "D: / zgtt" debug = "0" reloadable = "true"</p> <p>CrossContext = "true"> </ context> and save the file. (4) Start the Tomcat server (see "IV, Test Tomcat" (1)). (5) After entering the http: // localhost: 8080 / zgtt / index.jsp link, if you see "Hello World!", It means that the virtual directory ZGTT is set successfully. 6. Install apache (apache_2.0.44-win32-x86-no_ssl.msi) (1) Change the installation directory when installing, set to C: /. (2) Parameter settings can beyed any value (note to fill in the format of the prompt). (3) Modify a small error: Apache2.0.44 has a small problem. After the default installation is successful, there is no index.html file in the HTDOCS directory under the Apache2 home, we must use this directory.</p> <p>The down index.html.en is renamed as index.html. (4) Resolve the Chinese: Edit the configure file httpd.conf in editing the C: / Apache2 / Conf directory. Open it with Notepad and find "AddDefaultcharset</p> <p>ISO-8859-1, comment out "AddDefaultCharset ISO-8859-1", ie, add a "#" character before "AddDefaultCharset ISO-8859-1".</p> <p>Then add the following three lines in "#adddefaultcharset ISO-8859-1": adddefaultcharset GB2312 DEFAULTLANGUAGE GB2312 ADDLANGUAGUAGUAGE GB2312 AddLAGUAGUAGUAGUE GB2312 AddLAGUAGUGUAGUGE GB2312 AddLAGUAGUE EN. CN Seven, Test Apache After installing the Apache server, we need to test it to see if it is successful. (1) Start Apache Server: Point "Start" -> "Program" -> "Apache Http Server 2.0.44" -> "Control Apache Server" -> "Monitor Apache Servers", if you see in the system "Turnd" The green small triangle appears on the feather icon of Apache. Then, the Apache server is successfully launched. (2) After entering "http: // localhost" in IE, see the Apache's Apache home page indicates successful installation. (3) Turn off the Apache server: Click the Apache icon in the System "Tow", select "Stop", if you see red on the system "Dilast", you can see red on the feathers icon of Apache.</p> <p>A dot. The Apache server is successfully closed. Eight, integrated Apache servers and Tomcat servers This is the most critical step. Be sure to configure it carefully: (1) Turn off the Apache server (see "Seven, Test Apache" in (3)). (2) Turn off the Tomcat server. (See "IV, Test Tomcat" (3)). (3) Copy mod_jk2-2.0.43.dll to the C: / Apache2 / Modules subdirectory. (4) Edit the configuration file httpd.conf in the C: / Apache2 / Conf directory. At the end of this file add the following lines: LoadModule jk2_module modules / mod_jk2-2.0.43.dll <VirtualHost *> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "C: / Tomcat 4.1 / webapps" ServerName dummy-host .example.com DirectoryIndex index.htm index.html index.jsp ErrorLog logs / dummy-host.example.com-error_log CustomLog logs / dummy-host.example.com-access_log common </ VirtualHost> Note to DocumentRoot line with their The Tomcat installation directory is consistent. DirectoryIndex is a file that automatically explains the JSP type. (5) Newly built a file in the C: / Apache2 / Conf directory, must be named Workers2.properties. The contents of workers2.properties are as follows: [SHM] file = $ {serverroot} /logs/shm.file size = 1048576 # Example Socket Channel, Override port and host. [Channel.Socket: localhost: 8009] Port = 8009 Host = 127.0. 0.1 # define the worker [ajp13: localhost: 8009] channel = channel.socket: localhost: 8009 # URI mapping [uri: / *] worker = ajp13: localhost: 8009 Nine, test Apache server and Tomcat server integration (1) startup Apache Server (see "7. Test Apache" in (1)). (2) Start the Tomcat server (see "4. Test Tomcat" in (1). (3) Enter "http: // localhost: 8080 / zgtt / index.jsp" in IE. After the link, if "Hello World!" Is seen, it indicates that Tomcat starts successfully. (4) Enter "http: //localhost/zgtt/index.jsp" in IE.</p> <p>After link, if you see "Hello World!" Again, the Apache server and Tomcat server are integrated successfully. Note: Then install it. (My installation in g: / program files / apache group g: / program files / apache group / apache group / tomcat 5.0.7) then copy mod_jk_2.0.46.dll to g: / program Files / Apache Group / Apache2 / Modules under.</p> <p>First modify G: / Program files / apache group / apache2 / conf / http.conf: Find "DirectoryIndex", add index.jsp to then after INDEX.html: DirectoryIndex index.html index.jsp index.html.var Find "Listen", modify the port number below this: #Listen 12.34.56.78:80Listen 80 plus the following: loadingModule JK_Module Modules / Mod_jk_2.0.46.dll JkWorkersFile "G: / Program Files / Apache Group / Tomcat 5.0.7 / conf / workers.properties "JkLogFile" G: / Program Files / Apache Group / Tomcat 5.0.7 / logs / mod_jk2.log "JkLogLevel info <VirtualHost *> ServerAdmin lnboy@delphibbs.comDocumentRoot" G: / Program Files / Apache Group / Tomcat 5.0.7 / webapps / ROOT "ServerName www.delphibbs.comDirectoryIndex index.html index.htm index.jspErrorLog logs / shsc-error_log.txtCustomLog logs / shsc-access_log.txt commonJkMount / servlet / * ajp13 # Let Apache support to transmit to servlets, to Tomcat analysis jkmount /*.jsp Ajp13 # Let Apache support to transfer to JSP, to Tomcat analysis </ virtualhost> Save http.conf.</p> <p>New Workers.Properties under G: / Program Files / Apache Group / Tomcat 5.0.7 / Conf.</p> <p>Write the following: workers.tomcat_home = g: / program files / apache group / tomcat 5.0.7workers.java_home = g: /jbuilder9/jdk1.4 ps = / worker.list = ajp13 worker.ajp13.port = 8009 worker. Ajp13.host = localhost worker.ajp13.type = ajp13 worker.ajp13.lbFactor = 1</p> <p>Save Workers.properties.</p> <p>Finally, start Tomcat first, then start Apache, it is successful. Open http://127.0.0.1/ and http://127.0.0.1/ and http://127.0.0.1:8080/ can see the welcome screen of Tomcat. In G: / Program Files / Apache Group / Tomcat 5.0.7 / WebApps / Root, create a new demo.htm file, write Hello, World !!!, and save it. Open http://127.0.0.1/demo.htm and http://127.0.0.1:8080/demo.htm, you can see the newly built pages just now. But if you open http://127.0.0.1/jsp-examples/, 404 errors will appear, and http://127.0.0.1:8080/jsp-examples/ is normal. Next we need to add a mapping of the virtual directory in http.conf.</p> <p>Find in http.conf: "Alias", continue to find "icons", find one below: Alias ​​/ ICONS / "G: / Program Files / Apache Group / Apache2 / icons /"</p> <p><Directory "G: / Program Files / Apache Group / Apache2 / Icons"> Options Indexes MultiViews Allowoverride None Order Allow, Deny Allow from all </ directory></p> <p>Add I need the virtual directory: Alias ​​/ JSP-Examples / "G: / Program Files / Apache Group / Tomcat 5.0.7 / WebApps / Servlets-Examples"</p> <p><Directory "G: / Program Files / Apache Group / Tomcat 5.0.7 / webapps / servlets-examples"> Options Indexes MultiViews AllowOverride None Order allow, deny Allow from all </ Directory> Restart apache, which under http: // 127.0.0.1/jsp-examples/ can be opened (note that there is different from Tomcat, because Apache's default document does not contain index.html)</p> <p>I finally understood that I have never been successful before, one for the previous reason is: http.conf "g: / program files / apache group / tomcat 5.0.7 / webapps / root" like a space-containing path There is no quotation, causing Apache to be parsed correctly, so it has been wrong: (, most of them are installed in C: / Apache, C: / Tomcat5 path, so do not encounter such errors .</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-13584.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="13584" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.037</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '3B4PrHR8bzQJjqcDgt8sROH0qlB0iWSrX_2BL0Gdn3SKhW_2BzHsLU2HqbDisOOc7HCzTMKXAckSWZU9a7gUnEFClw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>