From 78186138
First, preface
For Mao to use the Nginx Server proxy, not directly with Tomcat 7.0, but also a long time to receive requests?
This is what I want to ask, the company's new project is to use NGINX+TOMCAT7+JDK development, the user name can directly access Tomcat, why also use Nginx? What is this stuff?
Second, why use Nginx?
In traditional Web projects, the amount of concurrency is small and users use less. So in the case of low concurrency, the user can access the Tomcat server directly, and then the Tomcat server returns the message to the user. For example, we upload images:
Of course we know that in order to solve concurrency, load balancing can be used: that is, we add a few more Tomcat servers. When the user accesses, the request can be submitted to the free Tomcat server.
However, there may be a problem with this scenario: uploading a picture operation. We uploaded the picture to the TOMCAT1, when we want to access this picture, tomcat1 just at work, so the request for access to other Tomcat operations, and Tomcat between the data is not synchronized, so it happened that we want to request the picture cannot be found.
To solve this situation, we came up with a distributed. We set up a picture server to store images. So when we all upload the picture, regardless of which server receives the picture, the picture is uploaded to the image server.
An HTTP server needs to be installed on the image server, using Tomcat, Apache, and Nginx.
See here you may ask, since we have to choose the HTTP server, why not continue to use Tomcat, but to use Nginx?
The reasons are as follows: Nginx often do static content service and proxy server (not you FQ that agent), facing the external request forwarded to the back of the application service (Tomcat,django what), Tomcat more used to do an application container, let Java Web App run in the things, corresponding to the same level of jboss,jetty and other things.
Learn from Blogs:
The difference between Nginx and Tomcat
Third, what is Nginx?
According to the previous comparison, we can see that Nginx is an HTTP server. is a high-performance HTTP server and reverse proxy server developed using the C language. Nginx is a high-performance HTTP server/reverse proxy server and e-mail (IMAP/POP3) proxy server. Developed by the Russian program designer Igor Sysoev, the official test Nginx can support 50,000 concurrent links, and the CPU, memory and other resource consumption is very low, the operation is very stable.
Application Scenarios of 3.1 Nginx
1, HTTP server. Nginx is an HTTP service that can provide HTTP services independently. Can do web static server.
2, virtual host. Can be implemented in a single server virtual out of multiple sites. For example, a personal web site uses a virtual host.
Port-based, different ports
Domain-based, different domain names
3, reverse proxy, load balancing. When the number of visits to a certain level of the site, a single server can not meet the user's request, you need to use more than one server cluster can use Nginx to do reverse proxy. And more than one server can share the load evenly, not because of a server load high downtime and a server idle situation.
Iv. Summary
Through the understanding of Nginx is also a more than a technology, but also very simple, the use is more convenient. The key point is that it can bring a lot of performance improvement to the system.
---------------------
arescarry-Wang Lei
Source: CSDN
Original: 73129270?utm_source=copy
Copyright NOTICE: This article is for bloggers original article, reprint please attach blog link!
What is Nginx? Why use Nginx?