What's the difference between Apache and Tomcat?

Source: Internet
Author: User
Tags tomcat server url forwarding

Often in the Apache and Tomcat and other servers, but the total feeling is still not clear what the relationship between them, in the use of Tomcat always appear Apache, always confused, who is the Lord who is the times, so deliberately in the online query some of this information, summed up:

One: Apache support static page, tomcat support dynamic, such as servlet, general use Apache+tomcat words, Apache is only as a forwarding, JSP processing is handled by Tomcat.
Apache can support Php\cgi\perl, but in order to use Java, you need tomcat backing up in Apache to send Java requests from Apache to Tomcat processing.
Apache is a Web server, Tomcat is an application (Java) server, it is just a servlet (JSP also translated into a servlet) container, can be considered as an Apache extension, but can run independently of Apache.

These two have the following points to compare:

1, both are developed by the Apache organization;

2, both have the function of HTTP service;

3, both are free.


Different points:
1, Apache is specifically used to provide HTTP services, and related configuration (such as virtual host, URL forwarding, etc.);

2, Tomcat is the Apache organization in accordance with the Java EE JSP, servlet Standard development of a JSP server.


Two: Apache is a Web server environment program enabled he can be used as a Web server, but only static web pages such as (asp,php,cgi,jsp) and other dynamic Web pages. If you want to run the JSP in the Apache environment, you need an interpreter to execute the JSP Web page and the JSP interpreter is Tomcat, why the JDK? Because JSP needs to connect to the database, the JDK to provide the drive to connect the database, so the Web server platform to run JSP needs apache+tomcat+jdk.



The benefits of consolidation are:
If the client requests a static page, only the Apache server responds to the request if the client requests a dynamic page, then the Tomcat server responds to the request. Because the JSP is the server-side interpreter, this consolidation can reduce Tomcat's service overhead.


Three: Apache: Focus on HTTP Server Tomcat: Focus on the servlet engine, if run in standalone mode, functionally equivalent to Apache, support JSP, but not ideal for static web pages;
Apache is a Web server, Tomcat is an application (Java) server, it is just a servlet (JSP also translated into a servlet) container, can be considered as an Apache extension, but can run independently of Apache. In other words, Apache is a truck that can be loaded with something like HTML. But there is no water, there must be a container (barrel) for the water, and the barrel can not be put on the truck.

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.