Java Fundamentals Hardening 99:apache and Tomcat server connections and differences

Source: Internet
Author: User
Tags tomcat server

1. Apache and Tomcat are Web network servers, both connected and differentiated, in the HTML, PHP, JSP, Perl and other development process, need to accurately grasp their own characteristics, choose the best server configuration.

Apache is a Web server ( static parsing, such as HTML), and Tomcat is a Java application server ( dynamic parsing, such as JSP, PHP)

Tomcat is just a servlet (JSP also translated into a servlet) container that can be considered an Apache extension, but can be run independently of Apache

The two can be compared from the following points:

(1) Both are developed by Apache organizations

(2) Both have the function of HTTP service

(3) Both are open source free of charge

2. Contact:

(1) Apache is a normal server, itself only support HTML is a normal Web page, can be supported by the plug-in PHP, and can be connected with Tomcat (Apache one-way connection tomcat, that is, Apache can access tomcat resources, otherwise ).

(2)Apache only support static Web pages , but like ASP, JSP, PHP, CGI and other Dynamic Web pages need to be handled by Tomcat .

(3) Apache and Tomcat are integrated using:

If the client requests a static page, only the Apache server needs to respond to the request ;

If the client requests a dynamic page, the Tomcat server responds to the request and parses the page code such as the parsed JSP ( after parsing the static HTML page ) back to Apache server, and then back to the browser via Apache.

This is because the JSP is the server-side interpretation code ,tomcat only do dynamic code parsing ,Apache callback parsing good static code ,apache+ This consolidation of Tomcat can reduce the service overhead of Tomcat .

(4)Apache and Tomcat are independent and can be integrated on the same server .

3. Differences

Apache is a C language implementation , supporting a variety of features and modules to extend the core functions, Tomcat is written in Java, better support servlet and JSP.

(1)Apache is a Web server, the Web server Delivery (serves) page allows the browser to browse, the Web server specifically handles HTTP requests (request), but the application server is provided through a number of protocols to the application ( Serves (business logic).

  Tomcat is an application server running on Apache, and the application server provides a method (methods) that the client application can invoke (call). It is just a servlet (JSP also translated into a servlet) container that can be considered an Apache extension, but can be run independently of Apache.

(2)Apache is an ordinary server, itself only support HTML static ordinary Web page . However, you can support PHP via plugins, and you can connect with Tomcat (one-way Apache connection Tomcat, which means that Tomcat resources can be accessed via Apache, or vice versa), and Tomcat is a jsp/servlet container, and also supports HTML, JSP, ASP, PHP, CGI, and so on, where CGI requires some manual debugging, but very easy.

(3)Apache focuses on HTTP server,tomcat with a focus on the servlet engine, which, if run in standalone mode, features Tomcat equivalent to Apache support JSP, but not ideal for static web pages.

(4)Apache can run for a year without restarting, and the stability is very good , and Tomcat is not.

(5) The preferred Web server is Apache, but Apache cannot parse the JSP, the servlet only with Tomcat.

(6) Apache is the most beginning page parsing service, Tomcat is developed after, in essence, the function of Tomcat can completely replace Apache, but Apache is the predecessor of Tomcat, and there are many people in the market still using Apache, So Apache will continue to exist, will not be replaced,Apache can not parse Java things, but parsing HTML fast .

4. Examples of both:

Apache is a car, which can be loaded with things such as HTML, but not water, to fill the water must have a container (bucket), and this bucket can not be placed on the truck, the bucket is Tomcat.

5. Integration of both:

Apache is a Web server environment program that enables him to be used as a Web server but only static Web pages are supported, not dynamic Web pages such as ASP, JSP, PHP, CGI

If you want to run the JSP in an Apache environment, you need an interpreter to execute the JSP Web page, and this JSP interpreter is Tomcat

Then why do we need the JDK? Since the JSP needs to connect to the database, the JDK is required to provide the drive to connect to the database, so the Web server platform to run the JSP requires Apache+Tomcat+jdk

6. Benefits of Consolidation:

If the client is requesting a static page, only the Apache server responds to the request

If the client requests a dynamic page, the Tomcat server responds to the request

Because JSP is a server-side interpretation code, consolidation can reduce the service overhead of Tomcat

Java Fundamentals Hardening 99:apache and Tomcat server connections and differences

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.