1. The difference between Nginx and tomcat
nginx is commonly used as a static content service and proxy server, directly forwarding external requests to subsequent application servers (tomcat, Django, etc.). Tomcat is more used as an application container to allow Java web apps to soak in things.
Strictly speaking, Apache and nginx should be called HTTP Server, while tomcat is an Application Server and a container for Servlet/JSO applications.
The client accesses resources stored on the server (HTML files, image files, etc.) through HTTP Server. HTTP Server only faithfully transmits the files on the server to the client through the HTTP protocol.
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 the HTTP Server
Note: nginx only distributes the request and does not process it! ! !
2. The difference between nginx and Apache
Apache is a synchronous multi-process model, one connection corresponds to one process, while nginx is one step, multiple connections (10,000 levels) can correspond to one process.
nginx is lightweight, anti-concurrency, and good at handling static files
Apache is super stable and supports PHP. nginx needs to be used with other backends and has advantages in handling dynamic requests
It is recommended to use the front-end nginx anti-concurrency and the back-end apache cluster, which will be better if they work together
The above is the detailed content of What is the difference between nginx, tomcat and apache?. For more information, please follow other related articles on the PHP Chinese website!