In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly talks about "what are the differences between apache and tomcat". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the differences between apache and tomcat"?
The difference between Apache and Tomcat:
Apache is only a Web server, can be run as an independent web server, but only support static pages, such as (asp,php,cgi,jsp) and other dynamic pages appear powerless.
Tomcat can also run as a stand-alone web server. But Tomcat is also an application (java) server, it is just a Servlet container.
Because Apache interprets static pages faster and more stably than tomcat, for the above reasons, a real website uses an Apache as a Web server to provide services for static page requests.
And use the Tomcat server as a Servlet/JSP plug-in to display the dynamic pages of the website.
Benefits of Apache+Tomcat integration:
1. Apache is mainly used to parse static text. For example, html,tomcat also has this function, but apache can greatly improve the efficiency. For enterprise applications with a large number of concurrency, it can better display the efficiency of apache.
2. Tomcat is used to parse jsp,servlet, etc. All customer requests will first be sent to Apache. If the request is a static text, it will be parsed by apache, and the result will be returned to the client. If it is a dynamic request, for example, jsp,apache will hand over the parsing work to tomcat and parsed by tomcat (first of all, the two must be integrated in reality). After tomcat parsing is completed, the result will still be returned to the client through apache. In this way, we can achieve division of labor and cooperation, achieve load balancing and improve the performance of the system! And because JSP interprets the code on the server side, integration can reduce the service overhead of Tomcat
Install Apache
Yum-y install httpd httpd-devel
Uninstall the native jdk environment
Rpm-ivh jdk-8u20-linux-x64.rpm installation jdk environment
. / jdk.sh configuration environment variable configuration environment variables
# vi / etc/profile
Append to the profile file
Export JAVA_HOME=/usr/java/jdk1.8.0_20
Export JAVA_BIN=/usr/java/jdk1.8.0_20/bin
Export PATH=$PATH:$JAVA_HOME/bin
Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Source / etc/profile let the / etc/profile file take effect immediately after modification.
Quantity
Java-version to view Java version number
Mkdir / opt/tomcat create tomcat installation directory
Tar-xzvf apache-tomcat-7.0.47.tar.gz decompresses tomcat source code packet
Cp-r apache-tomcat-7.0.47/* / opt/tomcat specifies an installation directory
Cd / opt/tomcat/bin/
. / startup.sh starts the tomcat service
Lsof-iPlux 8080 check to see if it is turned on successfully
Service iptables stop, turn off the firewall
Setenforce 0 shuts down selinux
You can now test whether tomcat has been successfully installed (visit: http://ip:8080)
Install a module that provides a uri path to distinguish the types of client access pages (mod_jk modules are also called connectors)
Tar-xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
Cd jakarta-tomcat-connectors-1.2.15-src/jk/native/
Yum-y install gcc gcc-c++- installation and compilation tool
. / configure-- with-apxs=/usr/sbin/apxs
Make
Make install
Check to see if mod_jk.so already exists
[root@wg63 native] # ls / etc/httpd/modules/mod_jk.so
/ etc/httpd/modules/mod_jk.so
Generate a configuration file for mod_jk
Cd / root/Desktop/ jakarta-tomcat-connectors-1.2.15-src/jk/conf
Cp workers.properties / etc/httpd/conf
Edit profile workers.properties
Vim / etc/httpd/conf/workers.properties
You can delete everything in workers.properties and add the following
Worker.list=worker1
Worker.worker1.type=ajp13
Worker.worker1.host=localhost
Worker.worker1.port=8009
Modify Apache configuration file
Vim / etc/httpd/conf/httpd.conf
Add index.jsp to the DirectoryIndex parameter
Add http://www.fuke029.com/ to the last line of the configuration file
LoadModule jk_module modules/mod_jk.so # load mod_jk.so module
JkWorkersFile / etc/httpd/conf/workers.properties # specifies the configuration file for the mod_jk module
JkMount / * .jsp worker1 # forwards all requests ending in .jsp to worker1
Service httpd restart restart Apache
Access http://localhost/index.jsp in the browser, if you can access the index.jsp page, the integration is successful.
At this point, I believe you have a deeper understanding of "what is the difference between apache and tomcat". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.