Nginx basic introduction & Reverse Proxy

What is nginx

Here Insert Picture Description

  1. Nginx web server is asynchronous frame can also be used as a reverse proxy, load balancers and HTTP caching. Most Web servers use Nginx, usually as a load balancer.
  2. Container web deployment project (written by deploying your project), common web container has: nginx, Apache, Tomcat
  3. The official claimed that one hundred thousand nginx can handle concurrent (when dealing with static resources should be able to reach this level)

nginx high concurrency principle (multi-process + epoll achieve high concurrency [select poll epoll])

  • Nginx after the start, there will be a master process and several independent worker process.
  • Each child process only one thread, IO multiplexing epoll model used to achieve high concurrency.

Comparative nginx and apache
Here Insert Picture Description
. 1) with respect to the advantages of the apache nginx

  1. Lightweight, also from the web service, take up less memory than apache and resources
  2. Anti concurrent, non-blocking Nginx processing request is asynchronous, and the apache is blocked type, low resource consumption Nginx high performance can be maintained under high concurrency
  3. Highly modular design, the preparation module is relatively simple, community activists, all kinds of high-performance modules produced rapidly ah

2) apache advantages with respect to nginx

  1. apache more mature, less bug, good stability
  2. rewrite, rewrite nginx powerful than the
  3. Module over more basic thought can be found

Nginx application scenarios

  1. http server. Nginx is a http http service can provide services independently. You can do a static web page server.

  2. Web Hosting. It can be implemented in a single server virtualized multiple sites. Such as web hosting personal Web site.

  3. Reverse proxy, load balancing. When the site's traffic reaches a certain level, a single server can not meet the user's request, the need to use multiple servers clusters can be used to make nginx reverse proxy. And multiple servers can share the load average, the situation will not be a high server load down a server while idle.

nginx reverse proxy

nginx reverse proxy

  • Reverse proxy transparent to the user, the client without any configuration to access services.
  • It refers to the actual operation mode proxy server to accept connection requests on the internet, and then forwards the request to the server on the internal network.
  • And returns the result obtained from the server to the client on request internet connection, in which case the external proxy server is a server performance.

Here Insert Picture Description
Reverse proxy role:

  • Ensure security within the network, usually as a reverse proxy to access the public network address, Web servers within the network
  • Load balancing, to optimize the loading site through reverse proxy server

Reverse proxy and web servers difference

  • Reverse proxy server: By giving your upstream configuration parameters, proxy_pass
  • web server deployment: web server should serve not our real project (django + uwsgi + nginx)
  • Several reverse proxy server: do not use LVS such as load balancing, only one load balancing server
  • Nginx reverse proxy server deployments background Why is not nginx: improve each web server processing capacity

Reference from here

Published 33 original articles · won praise 21 · views 1603

Guess you like

Origin blog.csdn.net/weixin_45139342/article/details/104642904