Home  >  Article  >  Java  >  The difference between nginx and tomcat

The difference between nginx and tomcat

(*-*)浩
(*-*)浩Original
2019-06-03 11:41:304200browse

nginx

Nginx (engine x) is a high-performance HTTP and reverse proxy web server, and also provides IMAP/POP3/SMTP services. Nginx was developed by Igor Sesoev for Russia's second most visited Rambler.ru site (Russian: Рамблер). The first public version 0.1.0 was released on October 4, 2004.

The difference between nginx and tomcat

It releases source code under a BSD-like license and is known for its stability, rich feature set, sample configuration files, and low system resource consumption. . On June 1, 2011, nginx 1.0.4 was released.

Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server, released under the BSD-like protocol. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx’s concurrency capabilities do perform better among web servers of the same type. Users of nginx websites in mainland China include: Baidu, JD.com, Sina, NetEase, Tencent, Taobao, etc.

Recommended course: Java Tutorial.

tomcat

Tomcat is a core project in the Jakarta project of the Apache Software Foundation, jointly developed by Apache, Sun and other companies and individuals. developed. Due to Sun's participation and support, the latest Servlet and JSP specifications can always be reflected in Tomcat. Tomcat 5 supports the latest Servlet 2.4 and JSP 2.0 specifications. Because Tomcat has advanced technology, stable performance, and is free, it is deeply loved by Java enthusiasts and recognized by some software developers, making it a popular Web application server.

Tomcat server is a free open source Web application server. It is a lightweight application server. It is commonly used in small and medium-sized systems and situations where there are not many concurrent access users. It is an important tool for development and The first choice for debugging JSP programs. For a beginner, you can think of it this way: when the Apache server is configured on a machine, it can be used to respond to access requests for HTML (an application under the Standard Universal Markup Language) page. In fact, Tomcat is an extension of the Apache server, but it runs independently when running, so when you run tomcat, it actually runs as a separate process from Apache.

The trick is that when configured correctly, Apache serves the HTML pages and Tomcat actually runs the JSP pages and Servlets. In addition, Tomcat, like Web servers such as IIS, has the function of processing HTML pages. In addition, it is also a Servlet and JSP container. An independent Servlet container is the default mode of Tomcat. However, Tomcat's ability to handle static HTML is not as good as the Apache server. The latest version of Tomcat is currently 9.0.

The difference between nginx and tomcat

nginx is often used as a static content service and proxy server to directly forward external requests to subsequent application services, while tomcat is more commonly used as a The application container, which allows Java web apps to run in it, corresponds to the same level as jboss, jetty and other things.

But nothing is absolute. nginx can also provide application functions through module development, and tomcat can also directly provide http services. It is usually used in intranets and scenarios that do not require small services such as flow control.

Strictly speaking, Nginx should be called "HTTP Server"; while Tomcat is an "Application Server", or more accurately, a container for "Servlet/JSP" applications (Ruby/Python Applications developed in other languages ​​cannot run directly on Tomcat).

An HTTP Server is concerned with transmission and access control at the HTTP protocol level, so on Apache/Nginx you can see functions such as proxy and load balancing. The client accesses resources stored on the server (HTML files, image files, etc.) through HTTP Server. Through CGI technology, the processed content can also be distributed through HTTP Server, but an HTTP Server always only faithfully transmits the files on the server to the client through HTTP protocol.

The application server is a container for application execution. It first needs to support the runtime of the development language (for Tomcat, it is Java) to ensure that the application can run normally on the application server. Secondly, it needs to support application-related specifications, such as class libraries and security features. For Tomcat, it is necessary to provide standard class libraries, Interfaces, etc. required for JSP/Sevlet operation. For convenience, application servers often integrate HTTP Server functions, but they are not as powerful as professional HTTP Servers. Therefore, application servers often run behind HTTP Servers, execute applications, and convert dynamic content into static content through HTTP Server distributes to clients.

The above is the detailed content of The difference between nginx and tomcat. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn