The difference between Apache, Nginx and Tomcat

Source: Internet
Author: User
Tags tomcat server url forwarding
first, the definition: 1. Apache

The Apache HTTP server is a modular server that can be run on almost any widely used computer platform. It belongs to the application server. Apache support modules, stable performance, Apache itself is static resolution, suitable for static HTML, images, etc., but can be extended scripts, modules and other support dynamic pages.

(Apche can support Phpcgiperl, but to use Java, you need tomcat backing in the Apache background, the Java request from Apache to Tomcat processing.) )

Disadvantage: The configuration is relatively complex and does not support dynamic pages itself. 2. Tomcat:

Tomcat is an application (Java) server that is only a servlet (JSP translates into a servlet) container that can be considered an Apache extension, but can be run independently of Apache. 3. Nginx

Nginx is a very lightweight HTTP server written by the Russians, Nginx, which is pronounced "engine X" and is a high-performance HTTP and reverse proxy server, as well as a IMAP/POP3/SMTP proxy server.

Two, compare 1. The comparison between Apache and Tomcat

Same point:

L Both were developed by the Apache organization.

L Both have the function of HTTP service

L both are free.

different points:

Apache is dedicated to providing HTTP services, and related configuration (such as virtual host, url forwarding, and so on), while Tomcat is the Apache organization in accordance with Java EE JSP, servlet Standard development of a JSP server.

L Apache is a Web server environment program that enables him to use as a Web server, but only static web pages such as dynamic pages (ASP,PHP,CGI,JSP) are not available. 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.

Apache: Focus on Httpserver, Tomcat: Focus on the servlet engine, if run in standalone mode, functionally equivalent to Apache, support JSP, but not ideal for static web pages;

L Apache is a Web server, Tomcat is an application (Java) server, it's just a servlet (JSP translates into a servlet) container that can be considered an Apache extension, but can be run independently of Apache.

the actual use of Apache and Tomcat is often consolidated using:

L If the client requests a static page, only the Apache server is required to respond to the request.

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

Because JSP is the server-side interpreter, this consolidation can reduce Tomcat's service overhead.

You can understand that Tomcat is an extension of Apache.      2. Nginx vs. Apache 1) nginx advantages relative to Apache

L Lightweight, same Web services, consumes less memory and resources than Apache

L Anti-concurrency, Nginx processing request is asynchronous non-blocking, while Apache is blocking , in high concurrency Nginx can maintain low resource consumption high performance

L highly modular design, writing module is relatively simple

• Provide load balancing

L Community Active, various high-performance modules produced quickly 2 The advantages of Apache relative to Nginx

L The rewrite of Apache is stronger than Nginx;

L support dynamic page;

L support a number of modules, basically covering all applications;

L stable performance, and nginx relative bugs. 3) Comparison between the advantages and disadvantages

L Nginx Configuration concise, Apache complex;

L Nginx Static processing performance is 3 times times higher than Apache;

Apache support for PHP is relatively simple, Nginx need to cooperate with other backend use;

L Apache has more components than Nginx;

L Apache is a synchronous multi process model, one connection corresponds to a process; Nginx is asynchronous and multiple connections (million levels) can correspond to a process;

l Nginx handle static files well and consumes less memory;

L Dynamic request is done by Apache, Nginx only for static and reverse;

L Nginx is suitable for front-end server, the load performance is very good;

L Nginx is itself a reverse proxy server and supports load Balancing 3. Summary

L NGINX Advantages: Load Balancing, reverse proxy, processing static file advantages. Nginx handles static requests faster than Apache;

Apache Advantage: processing static files is an advantage over Tomcat servers, and it is fast. Apache is static parsing, suitable for static HTML, images, and so on.

Tomcat: Dynamic parsing container, processing dynamic request, is compiled Jsp\servlet container, nginx have dynamic separation mechanism, static request can directly through Nginx processing, dynamic request before forwarding request to Tomcat for processing.

Apache in the processing dynamic has advantages, nginx concurrency is better, CPU memory footprint, if rewrite frequent, it is more suitable for Apache.


the understanding of the reverse proxy:

A reverse proxy (Reverse proxy) means to accept a connection request on the Internet with a proxy server, and then forward the request to a server on the internal network.

and returns the results from the server to the client on the Internet requesting a connection, at which point the proxy server behaves as a server.

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.