The difference between Apache, Nginx and Tomcat

Source: Internet
Author: User
Tags url forwarding

One, definition: 1. Apache

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

(Apche can support Phpcgiperl, but to use Java, you need Tomcat to support Apache in the background, and Java requests are forwarded to Tomcat for processing by Apache.) )

Cons: The configuration is relatively complex and does not support dynamic pages on its own.

2. Tomcat:

Tomcat is an application (Java) server, which 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.

3. Nginx

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

Second, compare 1. Comparison of Apache and Tomcat

Same point:

L both are developed by Apache organizations.

L Both have the function of HTTP service

L both are free.

Different points:

Apache is dedicated to providing HTTP services and related configurations (such as virtual hosting, URL forwarding, etc.), while Tomcat is a JSP server developed by Apache in Java EE-compliant JSP and servlet standards.

Apache is a Web server environment program that enables him to be used as a Web server, but only supports static web pages such as Dynamic Web pages (asp,php,cgi,jsp). If you want to run the JSP in the Apache environment, you need an interpreter to execute the JSP Web page, and this 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;

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 an Apache extension, but can be run independently of Apache.

The actual use of Apache and Tomcat is often integrated using:

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

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

Because JSP is the server-side interpretation code, this consolidation reduces the service overhead of Tomcat.

an extension of Tomcat to Apache can be understood.

2. Nginx vs. Apache 1) The advantages of nginx versus Apache

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

L Anti-concurrency, Nginx processing request is asynchronous non-blocking, and Apache is blocking type , in high concurrency, nginx can keep low resource consumption and high performance

L highly modular design, relatively simple to write modules

L Provide load balancing

L Community Active, various high-performance modules produced quickly

2) The advantages of Apache with respect to Nginx

L Apache rewrite is stronger than nginx;

L support dynamic pages;

L support a large number of modules, covering almost all applications;

L stable performance, and nginx relative bugs more.

3) comparison between the pros and cons

L Nginx Configuration concise, Apache complex;

L Nginx static processing performance than Apache 3 times times higher than;

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

L Apache has more components than Nginx;

Apache is a synchronous multi-process model, a connection corresponding to a process; Nginx is asynchronous, multiple connections (million levels) can correspond to a process;

L Nginx handles static files well, consumes less memory;

L dynamic request by Apache to do, nginx only suitable for static and reverse;

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

Nginx itself is a reverse proxy server, and supports load balancing

3. Summary

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

Apache Advantage: Handling static files is its advantage over the Tomcat server and is fast. Apache is static parsing, suitable for static HTML, pictures and so on.

L Tomcat: Dynamic parsing of containers, processing dynamic requests, is compiled Jsp\servlet container, Nginx has a dynamic separation mechanism, static request can be directly through nginx processing, dynamic request forwarding request to the background by Tomcat processing.

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

Understanding of Reverse proxies:

The reverse proxy is a proxy server that accepts connection requests on the Internet and then forwards the requests to the servers on the internal network (Reverse proxies).

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

http://blog.csdn.net/zzjstudent/article/details/50856546

The difference between Apache, Nginx 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.