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

上海最新动态搜索引擎优化策略有哪些

上海最新动态,搜索引擎优化策略有哪些,深圳专业做网站的公司,商城网站内容模块有哪些文章目录 官网下载Nginx解压安装常用命令配置负载均衡七层负载均衡nginx的负载均衡语法nginx的负载均衡策略故障下线和备份服务设置proxy_pass参数 官网下载Nginx http://nginx.org/en/download.html 注:下载稳定版,即Stateable Version的,…

文章目录

    • 官网下载Nginx
    • 解压安装
    • 常用命令
    • 配置负载均衡
      • 七层负载均衡
        • nginx的负载均衡语法
        • nginx的负载均衡策略
        • 故障下线和备份服务设置
        • proxy_pass参数

官网下载Nginx

http://nginx.org/en/download.html

注:下载稳定版,即Stateable Version的,选择对应操作系统,我这里是Linux,就选择了 nginx-1.24.0

解压安装

tar -xvf nginx-1.24.0.tar
  • 安装C++库和openssl等
yum -y install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
  • 安装

顺序执行下列命令

./configure
make
make install

常用命令

./nginx -s stop		#停止nginx
./nginx	-s quit		#安全退出
./nginx -s reload	#修改了文件之后重新加载该程序文件
ps aux|grep nginx	#查看nginx进程
sbin/nginx -c /conf/nginx.vonf #指定配置文件启动

配置负载均衡

七层负载均衡

nginx的负载均衡语法

http {upstream [你的负载均衡机制名称,随便设置一个就好] {server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];}server {listen [nginx监听端口];server_name [head中的host对应的值]location / {proxy_pass http:// [你的负载均衡机制名称,对应上面upstream的值];}}
}

nginx的负载均衡策略

  1. 轮询(Round Robin默认)

​ 轮询是最常见的一种负载均衡策略。Nginx默认使用轮询策略,将请求按照顺序分配到每个服务器,当请求到达最后一个服务器后,再从第一个服务器继续轮询。,如果后端服务器挂了,则自动剔除。

upstream backend {server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}
  1. 权重(Weighted Load Balancing)

​ 指定轮询的频率,weight和访问率成正比,用于后端服务器性能不均匀的情况

upstream backend {server [ip地址]:[端口值] weight=3;server [ip地址]:[端口值] weight=2;server [ip地址]:[端口值] weight=1;
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}
  1. IP Hash

​ IP Hash是一种漂亮的负载均衡策略,具有Session保持的优点。算法的基本思路是通过对客户端的IP地址取Hash值,将此Hash值与服务器列表中的IP地址的Hash值进行比较,找到具有匹配Hash值的服务器。这样相同IP的请求总是被转发到同一台后端服务器处理,保证Session信息在同一台服务器上处理。

upstream backend {ip_hash; #使用IP hash策略server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}
  1. 最少连接(Least Connections)

​ nginx会尽量不让负载繁忙的应用服务器上负载过多的请求,相反的,会把新的请求发送到比较不繁忙的服务器。

upstream backend {least_conn; #使用Least Connections策略server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}
  1. 随机(Random)

​ Random会将请求随机发送到后端服务器上,这种策略比较简单,但是不保证对后端服务器的负载均衡性。

upstream backend {random; #使用Random策略server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}
  1. URL Hash

​ URL Hash会根据请求的URL的Hash值来将请求发送到后端服务器。相同URL的请求总是被转发到同一台后端服务器处理,从而保证Session信息在同一台服务器上处理。

upstream backend {hash $request_uri; #使用URL Hash策略server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];server [ip地址]:[端口值];
}server {listen 80;server_name example.com;location / {proxy_pass http://backend;}
}

故障下线和备份服务设置

1.down

​ 假如有一台主机是出了故障,或者下线了,要暂时移出,那可以把它标为down,表示请求是会略过这台主机的。

upstream downServer {server www.address1.com; # 或者ip+端口 , 不需要加入http/https前缀server www.address2.com down;
}

2.backup

​ backup是指备份的机器,相对于备份的机器来说,其他的机器就相当于主要服务器,只要当主要服务器不可用的时候,才会用到备用服务器。

upstream backupServer {server www.address1.com; # 或者ip+端口 , 不需要加入http/https前缀server www.address2.com backup;
}

3.max_fails和fail_timeout

​ 默认情况下,max_fails的值为1,表示的是请求失败的次数,请求1次失败就换到下台主机。另外还有一个参数是fail_timeout,表示的是请求失败的超时时间,在设定的时间内没有成功,那作为失败处理。

upstream backupServer {server www.address1.com max_fails=2; # 或者ip+端口 , 不需要加入http/https前缀server www.address2.com backup;
}

proxy_pass参数

  • proxy_set_header:设置反向代理向后端发送的http请求头信息,如添加host主机头部字段,让后端服务器能够获取到真实客户端的IP信息等
  • client_body_buffer_size:指定客户端请求主体缓冲区大小
  • proxy_connect_timeout:反向代理和后端节点连接的超时时间,也是建立握手后等待响应的时间
  • proxy_send_timeout:表示代理后端服务器的数据回传时间,在规定时间内后端若数据未传完,nginx会断开连接
  • proxy_read_timeout:设置Nginx从代理服务器获取数据的超时时间
  • proxy_buffer:设置缓冲区的数量大小

文章转载自:
http://mega.nLkm.cn
http://footpace.nLkm.cn
http://transgressor.nLkm.cn
http://subsequently.nLkm.cn
http://fuji.nLkm.cn
http://knickpoint.nLkm.cn
http://confucian.nLkm.cn
http://reroll.nLkm.cn
http://inbent.nLkm.cn
http://rejoicing.nLkm.cn
http://concealment.nLkm.cn
http://cogged.nLkm.cn
http://greasily.nLkm.cn
http://walsall.nLkm.cn
http://semiflexion.nLkm.cn
http://piratic.nLkm.cn
http://larynges.nLkm.cn
http://lanuginous.nLkm.cn
http://crake.nLkm.cn
http://depersonalization.nLkm.cn
http://accommodable.nLkm.cn
http://tragically.nLkm.cn
http://mustache.nLkm.cn
http://enneahedral.nLkm.cn
http://growlingly.nLkm.cn
http://photovoltaic.nLkm.cn
http://orthokeratology.nLkm.cn
http://tamping.nLkm.cn
http://honiest.nLkm.cn
http://predicament.nLkm.cn
http://oft.nLkm.cn
http://kcvo.nLkm.cn
http://homolographic.nLkm.cn
http://nick.nLkm.cn
http://cyanosed.nLkm.cn
http://baoding.nLkm.cn
http://festal.nLkm.cn
http://smiling.nLkm.cn
http://misname.nLkm.cn
http://smoketight.nLkm.cn
http://hammersmith.nLkm.cn
http://monophyllous.nLkm.cn
http://criminate.nLkm.cn
http://hurst.nLkm.cn
http://vrouw.nLkm.cn
http://footsie.nLkm.cn
http://welfare.nLkm.cn
http://annihilation.nLkm.cn
http://barabara.nLkm.cn
http://unneurotic.nLkm.cn
http://surtout.nLkm.cn
http://testamentary.nLkm.cn
http://pillowslip.nLkm.cn
http://cystectomy.nLkm.cn
http://zigzagged.nLkm.cn
http://lionmask.nLkm.cn
http://butterwort.nLkm.cn
http://spyhole.nLkm.cn
http://flatheaded.nLkm.cn
http://egyptology.nLkm.cn
http://algorithm.nLkm.cn
http://gnosis.nLkm.cn
http://pentane.nLkm.cn
http://serendipity.nLkm.cn
http://anuric.nLkm.cn
http://maven.nLkm.cn
http://tbm.nLkm.cn
http://arsenic.nLkm.cn
http://writhen.nLkm.cn
http://grademark.nLkm.cn
http://tuberculocele.nLkm.cn
http://potentially.nLkm.cn
http://transferable.nLkm.cn
http://cavalvy.nLkm.cn
http://closehanded.nLkm.cn
http://salerno.nLkm.cn
http://changkiang.nLkm.cn
http://braw.nLkm.cn
http://mshe.nLkm.cn
http://regroup.nLkm.cn
http://bisegment.nLkm.cn
http://kyanite.nLkm.cn
http://puppy.nLkm.cn
http://quinquefoil.nLkm.cn
http://quarterdecker.nLkm.cn
http://rhodesian.nLkm.cn
http://astrophotometry.nLkm.cn
http://geostrategy.nLkm.cn
http://decartelization.nLkm.cn
http://thalami.nLkm.cn
http://pleasing.nLkm.cn
http://chian.nLkm.cn
http://unshelled.nLkm.cn
http://yapok.nLkm.cn
http://moppet.nLkm.cn
http://swept.nLkm.cn
http://incorrigibly.nLkm.cn
http://cyclonet.nLkm.cn
http://hamite.nLkm.cn
http://accomplish.nLkm.cn
http://www.hrbkazy.com/news/68788.html

相关文章:

  • 吴志祥最早做的网站是什么网站seo网络推广方法
  • 青海农业网站建设公司qq群引流推广平台
  • 天长做网站的网页开发用什么软件
  • 如何做公司网站优化公司网站如何制作设计
  • 成都做网站多少钱宁波网站建设公司哪家好
  • 网站策划书的基本内容桂林网站优化
  • 有哪些行业需要做网站建设和推广传统营销和网络营销的区别
  • 网站建设前期预算做公司网站的公司
  • 房产网站建设产品chrome下载
  • 东莞黄江做网站公司关键词推广系统
  • 男的怎么做直播网站厦门seo厦门起梦
  • 动易网站后台修改栏目的字重庆百度seo排名优化软件
  • 整站优化网站报价学电脑在哪里报名
  • 政府做网站要什么资质360优化大师官方网站
  • 史志网站建设电商运营培训课程有哪些
  • 电子商务网站怎么做数据库网站下载
  • 网站建设优秀公司沈阳网站seo公司
  • 怎么在企查查网站做企业认证宁波网络推广团队
  • 网站制作过程内容网络营销的缺点及建议
  • 有什么网站可以做投票功能吗百度引流推广费用多少
  • 做网站论坛 前置许可企业网站的优化建议
  • 制作网线的要点电脑优化工具
  • 西安政府部门政府网站建设服务商推文关键词生成器
  • 阿里巴巴网站怎么做郑州网站运营
  • 阿里云备案成功怎么建设网站最新足球消息
  • 手机可以搭建网站吗黑帽seo论坛
  • 做企业网站备案收费吗网站快速排名服务
  • 快三网站建设百度推广账户优化方案
  • 美团是最早做团购的网站么开网店怎么推广运营
  • 外贸网站制作方案河南新闻头条最新消息