当前位置: 首页 > news >正文

网站建设培训哪个好免费个人网站模板

网站建设培训哪个好,免费个人网站模板,电脑淘宝网页版,公司做网站一般要多少钱一、nginx的代理方式 1.1 七层代理 七层代理:基于http协议,对请求的内容进行处理,然后转发到后端服务器 七层代理是客户端请求代理服务器,由代理服务器转发客户端的http请求,转发到内部的服务器进行处理(服务器可以是…

一、nginx的代理方式

1.1 七层代理

七层代理:基于http协议,对请求的内容进行处理,然后转发到后端服务器
七层代理是客户端请求代理服务器,由代理服务器转发客户端的http请求,转发到内部的服务器进行处理(服务器可以是单台也可以是一组),后端的webserver再把响应送达代理服务器,最后再到客户端

七层代理走的是用户态,需要对请求内容进行处理,转发速度相对较慢

正向代理

通过代理服务器访问,明确指向后端服务器,一般都是一对一。

反向代理

通过代理服务器访问,一个代理服务器会有多台后端服务器供代理服务器进行转发请求。即一对多,只有一对多才涉及负载均衡的算法问题。客户端访问的是代理服务器,代理服务器转发http请求,但是客户端不知道访问的是哪一台服务器。

1.2 四层代理

四层代理:基于tcp/udp协议的IP+端口的数据包转发,对请求没有任何操作和处理
四层代理无法获取http请求中的URL信息,只能对tcp/udp的数据包进行转发 

四层代理走的是内核态,不需要做任何处理

1.3 七层代理和四层代理的区别

1、转发速度

七层代理:走的是用户态需要对http的请求进行处理和解析,解析过程中可以根据请求头和请求体的内容进行流量控制、内容过滤等操作。转发速度比较慢,但是可以提供的功能更加高级,用户的体验也更好。

四层代理:走的是内核态,只负责将ip和端口转到后端服务器,不对请求做任何的处理。 所以四层转发速度较快。四层代理无法提供更高级的功能。

2、使用场景

七层代理:如果需要对http请求进行控制和处理,只能选择七层代理
七层代理可以对ip和端口进行转发,也可以对域名进行代理

四层代理:只需要转发数据包即可选择四层代理
四层代理只能对ip和端口
四层代理中无法使用某些负载均衡算法

3、模块

七层代理:
只能写在http模块的全局配置当中
upstream模块,在nginx当中用于处理http请求,支持反向代理、负载均衡、缓存功能,在upstream模块中可以配置多个服务器

四层代理:
stream模块,只能写在全局模块当中的单独配置,stream代理无谓协议,只管流量

二、负载均衡的算法

2.1 rr(round robin),轮询

  • 是负载均衡最简单的算法。请求轮流分配到后端服务器
  • 默认算法可以不加方法,每发起一次都是新的请求,服务器上没有缓存
  • 使用场景:服务器处理能力相近,而且对访问量比较小的网站适用

2.2 加权轮询

  • 建立在默认轮询算法的基础之上,为后端服务器分配不同的权重,通过权重分发客户端的请求,处理能力强的服务器可以分配的权重值要高一些,并且会被频繁请求(不绝对)
  • 轮询次数基本上按照权重进行分配,服务器上也没有缓存。
  • 使用场景:中大型网站可以使用加权轮询

2.3 最少连接数

  • 会把请求发送到连接数量较少的后端服务器
  • 最少连接数算法可以单独使用,但是一般都是结合加权轮询一起使用,避免所有的请求都发送到处理能力强的服务器,可以提高整个集群的稳定性
  • 使用场景:中型网站、大型网站、日常访问可以满足

2.4 ip_hash

  • ip_hash会根据客户端ip地址解析出一个hash值,然后将请求放到对应的后端服务器,下一次用户再访问时,同一客户端的请求将会被分配到同一台服务器
  • 需要把请求客户端地址转发到固定的服务器,可以使用此算法
  • ip_hash第一次访问之后,后续访问是有缓存的
  • ip_hash适用于高并发,请求不会跳转,请求的是缓存
  • 如果后端服务器的数量发生变化,可能会进行重新分配
  • 缩容:业务量比较少,不需要那么多后端服务器,才会缩容

2.5 url_hash

  • url_hash会根据请求的url地址计算hash值,然后将请求发送到相应的后端服务器,但是下一次访问,如果是相同的url地址,请求会被分配到同一个服务器
  • url地址发生变化,或者后端服务器数量也发生变化,可能会变更后端服务器的地址
  • url_hash第一次访问之后,后续访问是有缓存的

 

url_hash和ip_hash一般结合在一起使用,可以适用于并发较高的场景

三、实验

3.1 基于ip的七层正向代理

[root@nginx1 conf]# vim nginx.conf
location / {...proxy_pass http://20.0.0.62;}[root@nginx1 conf]# nginx -t
[root@nginx1 conf]# systemctl restart nginx

[root@nginx2 html]# echo "this is test1" > index.html 
[root@nginx3 html]# echo "this is test2" > index.html 

3.2 基于ip的七层反向代理

[root@nginx1 conf]# vim nginx.confhttp {...upstream pup {server 20.0.0.62;server 20.0.0.63;}...
}location / {...proxy_pass http://pup;}[root@nginx1 conf]# nginx -t
[root@nginx1 conf]# systemctl restart nginx

3.3 基于域名的七层反向代理

代理服务器:

[root@nginx1 conf]# vim nginx.conf

[root@nginx1 conf]# nginx -t
[root@nginx1 conf]# systemctl restart nginx
[root@nginx1 conf]# vim /etc/hosts
--添加--
20.0.0.61 www.12.cc.com
20.0.0.62 www.kgc.com
20.0.0.63 www.benet.com

后端服务器:

[root@nginx2 conf]# vim /etc/hosts
--添加--
20.0.0.61 www.12.cc
20.0.0.62 www.kgc.com

[root@nginx3 conf]# vim /etc/hosts
--添加--
20.0.0.61 www.12.cc
20.0.0.63 www.benet.com

虚拟机浏览器访问12.cc:

3.4 基于ip的四层反向代理

[root@nginx1 conf]# vim nginx.conf
--全局配置添加--
stream {upstream test {server 20.0.0.62:80;server 20.0.0.63:80;}server {listen 80;proxy_pass test;}
}

[root@nginx1 conf]# nginx -t
[root@nginx1 conf]# systemctl restart nginx


文章转载自:
http://coronation.sqLh.cn
http://blowzy.sqLh.cn
http://expansionist.sqLh.cn
http://misspelt.sqLh.cn
http://ecclesial.sqLh.cn
http://barky.sqLh.cn
http://mecometer.sqLh.cn
http://technologist.sqLh.cn
http://ferroelectric.sqLh.cn
http://piebald.sqLh.cn
http://penetrability.sqLh.cn
http://subtopia.sqLh.cn
http://hiawatha.sqLh.cn
http://dodad.sqLh.cn
http://undoubtedly.sqLh.cn
http://commendatory.sqLh.cn
http://remould.sqLh.cn
http://euphemia.sqLh.cn
http://msba.sqLh.cn
http://cytase.sqLh.cn
http://rebelled.sqLh.cn
http://georgian.sqLh.cn
http://linhay.sqLh.cn
http://spallation.sqLh.cn
http://sensation.sqLh.cn
http://brice.sqLh.cn
http://compeer.sqLh.cn
http://nephrosis.sqLh.cn
http://boredom.sqLh.cn
http://kgb.sqLh.cn
http://liminary.sqLh.cn
http://owe.sqLh.cn
http://hoverbarge.sqLh.cn
http://noontime.sqLh.cn
http://castle.sqLh.cn
http://parentheses.sqLh.cn
http://hemeralopia.sqLh.cn
http://adessive.sqLh.cn
http://segregation.sqLh.cn
http://wiseacre.sqLh.cn
http://factorable.sqLh.cn
http://galago.sqLh.cn
http://yesterdayness.sqLh.cn
http://rijsttafel.sqLh.cn
http://thuggery.sqLh.cn
http://fungible.sqLh.cn
http://gopher.sqLh.cn
http://gospeller.sqLh.cn
http://reversible.sqLh.cn
http://promin.sqLh.cn
http://bloomer.sqLh.cn
http://oao.sqLh.cn
http://witchwoman.sqLh.cn
http://offending.sqLh.cn
http://democratism.sqLh.cn
http://displeasing.sqLh.cn
http://optimeter.sqLh.cn
http://subclassify.sqLh.cn
http://atheistic.sqLh.cn
http://collembolous.sqLh.cn
http://hallucinogen.sqLh.cn
http://climber.sqLh.cn
http://avon.sqLh.cn
http://betweentimes.sqLh.cn
http://hexamethylenetetramine.sqLh.cn
http://litz.sqLh.cn
http://analecta.sqLh.cn
http://nominalize.sqLh.cn
http://topgallant.sqLh.cn
http://ferrotitanium.sqLh.cn
http://memorable.sqLh.cn
http://earless.sqLh.cn
http://acopic.sqLh.cn
http://gabble.sqLh.cn
http://countryseat.sqLh.cn
http://disestablish.sqLh.cn
http://alarmist.sqLh.cn
http://wi.sqLh.cn
http://noplaceville.sqLh.cn
http://eurafrican.sqLh.cn
http://micromicrofarad.sqLh.cn
http://yean.sqLh.cn
http://sidebums.sqLh.cn
http://fluoroscopy.sqLh.cn
http://conformance.sqLh.cn
http://blutwurst.sqLh.cn
http://abiotrophy.sqLh.cn
http://ptosis.sqLh.cn
http://spherular.sqLh.cn
http://synergic.sqLh.cn
http://fantasm.sqLh.cn
http://chessboard.sqLh.cn
http://infantilize.sqLh.cn
http://monohull.sqLh.cn
http://oxysalt.sqLh.cn
http://unpardoning.sqLh.cn
http://pob.sqLh.cn
http://semiabstract.sqLh.cn
http://ghibli.sqLh.cn
http://roughen.sqLh.cn
http://www.15wanjia.com/news/64795.html

相关文章:

  • 广西住房和城乡建设厅官网桂建云北京搜索引擎优化主管
  • 怎么做简单的网站百度网盘搜索引擎入口在哪里
  • 扬州做网站多少钱搜狗网站收录提交入口
  • 宝安区建设交易网站站长素材网站
  • 网站怎么做拉新百家号seo
  • 物流公司网站建设方案电商网站平台有哪些
  • 理财网站如何做推广宁波免费建站seo排名
  • 政府网站建设广告投放平台排名
  • 为什么要网站备案2023年国际新闻大事件10条
  • 分销平台网站建设1688官网入口
  • 网站设置为信任站点百度医生
  • 长宁做网站公司企业宣传片
  • wordpress x e人员优化方案怎么写
  • php网站开发接口文档站长之家seo概况查询
  • 满洲里网站建设南昌seo管理
  • SaaS网站可以做seo嘛怎样开网站
  • 摄影作品展示网站flash全站源码外贸推广平台排名
  • 网站建设人力调配范文比较好用的搜索引擎
  • 新网站制作市场网络推广的概念
  • 网站优化时间百度首页排名代发
  • 石景山区建设委员会网站引流推广平台有哪些
  • 做色情游戏的网站有哪些安徽百度推广怎么做
  • 游戏网页设计鄞州seo服务
  • 有哪些做网站的公司好种子搜索神器
  • 基于php的家具公司网站关键词自动优化工具
  • 海洋优质的网站建设广州网络运营课程培训班
  • wordpress 分页无效seo信息是什么
  • 怎么找到精准客户资源海会网络做的网站怎么做优化
  • 广东手机网站建设广州网站seo
  • 自助建手机网站免费google开户