What is The Difference Between Apache, Tomcat and Nginx

Source: Internet
Author: User
Keywords difference between apache and tomcat nginx and apache what is the difference between nginx and apache
1. Definition:

Apache

Apache HTTP server is a modular server that can run on almost all widely used computer platforms. It belongs to the application server. Apache supports many modules and stable performance. Apache itself is static analysis, suitable for static HTML, pictures, etc., but it can support dynamic pages, etc. through extended scripts, modules, etc.

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

 Disadvantages: The configuration is relatively complicated, and it does not support dynamic pages.

Tomcat:
Tomcat is an application (Java) server. It is just a Servlet (JSP is also translated into Servlet) container. It can be considered an extension of Apache, but it can run independently of Apache.


Nginx

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

2: comparison

1. Comparison of Apache and Tomcat

Same point:

Both are developed by the Apache organization

Both have the function of HTTP service

Both are free

difference:
        Apache is specifically used to provide HTTP services and related configurations (such as virtual hosts, URL forwarding, etc.), and Tomcat is a JSP server developed by Apache under the JSP and Servlet standards that comply with Java EE.

        Apache is a web server environment program, enabling it can be used as a web server, but it only supports static web pages such as (ASP, PHP, CGI, JSP) and other dynamic web pages. If you want to run JSP under the Apache environment, you need an interpreter to execute JSP web pages, and this JSP interpreter is Tomcat.

        Apache: focuses on HTTPServer, Tomcat: focuses on Servlet engine, if it runs in Standalone mode, it is functionally equivalent to Apache and supports JSP, but it is not ideal for static web pages;

        Apache is a Web server, and Tomcat is an application (Java) server. It is just a Servlet (JSP is also translated into Servlet) container. It can be considered an extension of Apache, but it can run independently of Apache.

        In actual use, Apache and Tomcat are often integrated:

        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.

        Because JSP interprets the code on the server side, this integration can reduce Tomcat's service overhead.

        It can be understood that Tomcat is an extension of Apache.

2. Comparison of Nginx and Apache

        Advantages of nginx over apache

        Lightweight, it also takes up less memory and resources than Apache

        Anti-concurrency, nginx processing requests is asynchronous and non-blocking, while apache is blocking. Under high concurrency, nginx can maintain low resources, low consumption and high performance

        Highly modular design, relatively simple to write modules

        Provide load balancing

        The community is active, and various high-performance modules are produced quickly

        The advantages of apache over nginx

        Apache's rewrite is more powerful than nginx;

        Support dynamic pages;

        There are many modules supported, basically covering all applications;

        The performance is stable, and nginx is relatively buggy.

        Comparison of the advantages and disadvantages of the two

        Nginx configuration is simple, Apache is complex;

        The static processing performance of Nginx is more than 3 times higher than that of Apache;

        Apache's support for PHP is relatively simple, and Nginx needs to be used with other backends;

        Apache has more components than Nginx;

        Apache is a synchronous multi-process model, one connection corresponds to one process; nginx is asynchronous, multiple connections (ten thousand levels) can correspond to one process;

        Nginx handles static files well and consumes less memory;

        The dynamic request is made by apache, nginx is only suitable for static and reverse;

        Nginx is suitable as a front-end server, with good load performance;

        Nginx itself is a reverse proxy server and supports load balancing

to sum up

        Nginx advantages: load balancing, reverse proxy, processing static files advantages. Nginx handles static requests faster than apache;

        Apache advantage: Compared with Tomcat server, processing static files is its advantage, and it is fast. Apache is static analysis, suitable for static HTML, images, etc.

        Tomcat: Dynamic analysis container, processing dynamic requests, it is a container for compiling JSP\Servlet, Nginx has a dynamic separation mechanism, static requests can be directly processed through Nginx, and dynamic requests are forwarded to the background to be processed by Tomcat.

   Apache has advantages in processing dynamics. Nginx has better concurrency and low CPU memory usage. If rewrite is frequent, then Apache is more suitable.
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.