1,网关
网关(Gateway)就是一个网络连接到另一个网络的“关口”。

在Nginx 配置负载均衡之后,可以进入到网关,在网关决定进入到哪个真实的web 服务器。
2,将Ngnix 配置 API 网关
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /project-a {
proxy_pass http://127.0.0.1:8000/;
index index.html index.htm;
}
location /project-b {
proxy_pass http://127.0.0.1:8001/;
index index.html index.htm;
}
}
}
通过拦截url 请求,如果是project-a 就走http://127.0.0.1:8000/ project-b 就走http://127.0.0.1:8001/;
网关是拦截所有服务器请求进行控制
过滤器拦截某单个服务器请求进行控制
Nginx是采用服务器负载均衡进行转发
Zuul依赖Ribbon和eureka实现本地负载均衡转发
相对来说Nginx功能比Zuul功能更加强大,能够整合其他语言比如lua脚本实现强大的功能,同时Nginx可以更好的抗高并发,Zuul网关适用于请求过滤和拦截等。
最后
以上就是天真口红最近收集整理的关于网关,过滤器,nginx区别和联系的全部内容,更多相关网关内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复