What can be done Nginx

What do Nginx

- Reverse Proxy

- Load Balancing

--HTTP server (static and dynamic separation)

- Forward Proxy

 

Reverse Proxy

Nginx reverse proxy should be made up of one thing, what is it the reverse proxy, the following statement is Baidu Encyclopedia: Reverse Proxy (Reverse Proxy) mode refers to the proxy server to accept connection requests on the internet, then forwards the request to the server on the internal network, and the results obtained from the server back to the client requesting the connection to the internet, in which case the external proxy server performance of a reverse proxy server. It simply is not true server directly access the external network, so you need a proxy server, and proxy server can simultaneously access the external network of any connection with the same real server in a network environment, of course, it may be the same server, port different.

Load Balancing

Nginx load balancing is a common feature, which means that load balancing across multiple operating units allocated to execution, such as Web servers, FTP servers, business-critical application servers and other mission-critical servers, so as to work together to complete the task. In simple terms it is that when there are two or more sets of servers, distributed according to a random rule request to the specified server process, load balancing configuration generally need to configure the reverse proxy, to jump through the reverse proxy load balancer. The Nginx currently supports three kinds of native load balancing strategy, there are two kinds of popular third-party policy.

HTTP server

Nginx itself is a static resource server, when only static resources, you can use the server Nginx to do, but now also popular movement separation can be achieved by Nginx, first look at server Nginx do static resources

 

 

If this visit http: // localhost will default access to the E drive wwwroot directory of index.html, if a site just static pages, then you can deploy to achieve in this way.

Static and dynamic separation

Static and dynamic separation is to make dynamic websites where dynamic pages according to certain rules to distinguish the same resources and often becomes a resource area, movement of resources to do after the split, we can according to the characteristics of static resources to do the cache operation, this is the core idea of ​​the site static treatment

 

这样我们就可以吧HTML以及图片和css以及js放到wwwroot目录下,而tomcat只负责处理jsp和请求,例如当我们后缀为gif的时候,Nginx默认会从wwwroot获取到当前请求的动态图文件返回,当然这里的静态文件跟Nginx是同一台服务器,我们也可以在另外一台服务器,然后通过反向代理和负载均衡配置过去就好了,只要搞清楚了最基本的流程,很多配置就很简单了,另外localtion后面其实是一个正则表达式,所以非常灵活

正向代理

正向代理,意思是一个位于客户端和原始服务器(origin server)之间的服务器,为了从原始服务器取得内容,客户端向代理发送一个请求并指定目标(原始服务器),然后代理向原始服务器转交请求并将获得的内容返回给客户端。客户端才能使用正向代理。当你需要把你的服务器作为代理服务器的时候,可以用Nginx来实现正向代理,但是目前Nginx有一个问题,那么就是不支持HTTPS,虽然我百度到过配置HTTPS的正向代理,但是到最后发现还是代理不了,当然可能是我配置的不对,所以也希望有知道正确方法的同志们留言说明一下。

 

 

resolver是配置正向代理的DNS服务器,listen 是正向代理的端口,配置好了就可以在ie上面或者其他代理插件上面使用服务器ip+端口号进行代理了。

原文链接:https://blog.csdn.net/qq_36125138/article/details/84144932

 

Guess you like

Origin www.cnblogs.com/isme-zjh/p/11389280.html