The difference between Apache and Tomcat

Source: Internet
Author: User

Apache and Tomcat are Web 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

Contact

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

2) Apache only supports static Web pages, but dynamic Web pages like ASP, JSP, PHP, CGI 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, parses the page code such as the JSP, and then passes it back to the Apache server, which is returned to the browser by 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+tomcat such integration can reduce the service cost of Tomcat.

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

difference

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, Web server delivery (serves) page allows the browser to browse, the Web server specifically handles HTTP requests (request), but the application server is through a number of protocols to provide (serves) business logic to the application ( 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 a normal 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 the HTTP Server,tomcat focus on the servlet engine, if run in standalone mode, the function of Tomcat and Apache equivalent support JSP, but the static Web page is not ideal.

4, Apache can run a year without restarting, stability is very good, and Tomcat is not necessarily.

5, the preferred Web server is Apache, but Apache can not parse the JSP, servlet only with Tomcat.

6, Apache is the very beginning of the page parsing services, 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 are still using Apache, Apache will continue to exist, will not be replaced, Apache can not parse Java things, but parsing HTML fast.

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.

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 needs APACHE+TOMCAT+JDK

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

Reference resources:

Http://www.admin10000.com/document/974.html

Http://www.bitscn.com/netpro/server/201007/188521.html

The difference between Apache and Tomcat

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.