Advantages, disadvantages and differences of nginx / Tomcat / Apache

Time:2022-5-13

Differences between nginx / Tomcat / Apache

Apache

Apache is a modular server, which can run on almost all computer platforms. It is an application server

shortcoming

The configuration is relatively complex, and the module cannot support dynamic pages without scripts

advantage

It supports many modules and stable performance. Because it is static parsing, it is suitable for processing static files (HTML, pictures, etc.), and can also support dynamic pages through extended scripts, modules, etc

Tomcat

Tomcat is an application server and just a servlet container

shortcoming

Basically, it can only be used as a java server

advantage

Processing dynamic requests is a container for compiling servlets

Nginx

Nginx is an HTTP and proxy server. Nginx is often used as a static content service and proxy server to forward external requests to application services (tomcat, Django).

shortcoming

Only suitable for static and reverse proxy

advantage

Load balancing, reverse proxy, dynamic and static separation. Static requests can be processed directly through nginx, and the processing efficiency is higher than that of Apache. Only dynamic requests need to be forwarded to Tomcat for processing

summary

Apache / nginx should be called HTTP server

Tomcat is an application server, (Java project fhadmin. CN). To be exact, it should be a container for servlet / JSP applications.

HttpServer

An httpserver is concerned with transmission and access control at the HTTP protocol level, so

You can see proxy, load balancing, etc. on Apache / nginx. The client accesses the resources stored on the server (HTML files, image files, etc.) through HTTP server

application server

It is the container for executing applications. First of all, it needs to support the runtime of the development language (for tomcat, it is Java). Secondly, we need to support application related specifications, such as class libraries and security features. For tomcat, it is necessary to provide standard class libraries for JSP / sevlet operation.

For convenience, the application server often integrates the functions of HTTP server, but it is not as powerful as professional HTTP server. Therefore, the application server often runs behind the HTTP server, executes the application, converts the dynamic content into static content, and then distributes it to the client through HTTP server.

This work adoptsCC agreementThe author, link and reprint of this article must be indicated