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

徐州 网站 备案 哪个公司做的好现在最火的推广平台有哪些

徐州 网站 备案 哪个公司做的好,现在最火的推广平台有哪些,手机做任务的网站有哪些内容,公司网站栏目nginx的内置变量 客户端 命令含义$uri可以获取客户端请求的地址,包含主机和查询的参数$request_uri:获取客户端的请求地址,包含主机和查询参数。$host:请求的主机名,客户端—发送请求的url地址$http_user_agent获取客户端请求的浏览器和操作…

nginx的内置变量

客户端

命令含义
$uri可以获取客户端请求的地址,包含主机和查询的参数
$request_uri:获取客户端的请求地址,包含主机和查询参数。
$host:请求的主机名,客户端—发送请求的url地址
$http_user_agent获取客户端请求的浏览器和操作请求
$remote_addr客户端的IP地址(可以隐藏)
$remote_port客户端的端口
$request_method获取客户端的的请求方式
$request_filename获取客户端请求的文件名

服务端

命令含义
$server_addr可以查询到服务端的IP地址
$server_port服务端的端口号
$scheme获取请求的协议
$document_root当前请求的根目录

nginx在配置location匹配时,会使用两个获取头部的内置变量:
X-Real-IP:直接向服务端发送客户端访问的真实ip地址

proxy_set_header X-Real-IP $remote_addr

X-Forwarded-For:传递完整的代理链,只要数据包经过代理,都会被传送nginx,记录所有的代理地址和客户端的真实ip

proxy_set_header X-Forwarded_For  $porxy_add_x_forwarded_for;记录所有经过的代理地址

nginx的代理

代理:访问一个代理的地址就可以指向目标访问的网页

代理的分类

nginx的代理分为欸正向代理和反向代理
正向代理:七层代理
反向代理:七层代理和四层代理
四层代理:传输层:ip+端口
七层代理:应用层:http协议

区别

四层代理和七层代理的区别:
1、四层代理是基于tcp/ip协议层的代理转发方式,只是基于ip+端口号的实现代理
四层代理无法获取http请求中的url信息,只是对数据包进行转发
四层转发数据包,是由内核进行转发,速度都更快。内核态(开发)
2、七层代理是通过http协议进行代理转发的方式
处理http的请求和响应
当收到http请求之后,根据代理的方式,把http请求转发到指定的服务器
可以对http请求进行深入的分析和处理的,可以对请求内容做路由,流量控制,可以内容过滤等等
七层代理的是由应用层处理,用户态来处理,速度相对较慢,但是更安全,更可靠
同时能做四层代理和七层代理的有nginx,Haproxy
lvs只能做四层转发

正向代理

正向代理都是需要对请求进行处理,属于七层代理。
正向代理是面向客户端,客户端想要访问web服务器,但是客户端的ip地址禁止访问,通过代理的ip地址访问目标的服务器。
服务端只会知道代理服务器的地址,但是不知道客户端的ip地址

特点

正向代理的特点:
1、代理的ip地址和访问的服务端对客户端来说是已知的
2、后端服务器不知道客户端的ip地址

配置

正向代理可以进行有多个配置文件

http {
...
include  /usr/local/nginx/conf.d/*.conf;
#添加了这一段之后,可以在conf.d这个目录里面,配置多个conf文件,也可以有其他的配置文件,作为服务的配置文件
}

自行代理

vim conf.d/zxdl.conf
server {listen 8888;server_name localhost;resolver 218.2.135.1 valid=300 ipv6=off;#设置dns的解析地址,解析的缓存时间是300秒,每隔300秒重新解析一次resolver_timeout 3s;#设置解析服务的超时3秒proxy_read_timeout 30s;#设置代理服务器读取的超时时间proxy_send_timeout 30s;#代理服务器向后端服务器发送数据的超时时间proxy_connect_timeout 30s;#代理服务器和后端服务器连接的超时时间#固定代理地址set  $url "www.baidu.com";location / {proxy_pass http://$url#请求转发的语句#正向代理的缓存配置proxy_buffers 256 4k;#设置后端缓存影响的缓冲区为256个,每个大小为4kproxy_max_temp_file_size 0;#nginx不保存响应数据的临时文件,防止文件过多,占用硬盘空间proxy_cache_valid 200 302 1m;#针对响应码是200302,缓存的有效期是1分钟proxy_cache_valid 301 1h;#针对响应码是301的,缓存的有效期是1小时proxy_cache_valid any 1m;#除了200301302以外,其他的响应码都缓存1分钟}
}

自动代理

vim conf.d/zddl.conf
servere {listen 8889;location / {proxy_pass $scheme://$http_host$requst_uri#请求带了地址自动设置  #自动选择协议 http  https#$http_host 目标主机 $request_uri包含完整的请求的路径proxy_set_header Host $http_host;#在请求头当汇总传递客户端的host信息proxy_set_header X_Real_IP $remote_addr#设置客户端的请求当中包含真实的ip地址proxy_set_header X_Forwarded_For $proxy_add_x_forwarded_for;#传递客户端经过的代理地址proxy_set_header X_Forwarded_Proto $scheme;#传递客户端的请求的协议信息http httpsproxy_set_header X_Forwarded_Host $host;#传递客户端的主机名(IP地址)proxy_set_header X_Forwarded_Port $server_port;#传递给服务端,客户端请求服务端的端口resolver 218.2.135.1;#设置dns地址resolver_timeout 10s;proxy_buffers 256 4k;proxy_max_temp_file_size 0;#设置缓存的保存时间proxy_cache_valid 200 302 1m;#针对响应码是200302,缓存的有效期是1分钟proxy_cache_valid 301 1h;#针对响应码是301,缓存的有效期是1小时proxy_cache_valid any 1m;#除了200,301,302以外,其他的响应码都缓存1分钟。}
}

反向代理

反向代理又叫负载均衡:将四层或者七层的请求分配到多台后端的服务器上,从而分担整个业务的负载,提高系统的稳定性,也可以提供高可用(备灾,其中一台后端服务器如果发生故障不影响整体业务)

负载均衡的算法

1、round robin 轮询:负载均衡的默认算法,请求轮流分配给后端服务器
轮询算法适用于后端服务器处理能力相近的情况,默认的算法,可以不加
2、weight round robin 加权轮询:轮询的升级版,给每个后端服务器赋予不同的权重,处理能力更强的服务器设置更高的权重,处理能力低的,设置低权重
高峰时期可以通过这个方法进行流量的优化,适用于服务器处理能力差异比较大的情况
3、ip_Hash:当我们访问后端服务器,根据客户端的ip地址,使用hash算法计算出ip地址的hash值,然后再把请求发送到相应的后端服务器。
如果客户端访问的ip地址相同,通过hash算法,再一次的请求会被分配到上一次访问的服务器,保证会话的稳定,负载均衡的会话保持---->ip_hash
会话保持到期之后,会话中断,重新请求会重新计算hash值
4、最小连接数(配合加权轮询一块使用):最少链接数的算法可以将请求发送到当前连接比较少的后端服务器
这种算法适用后端服务器处理任务耗时不同的情况,可以有效的避免所有的请求集中在处理能力更强的后端服务器上。
5、URL_HASH:根据请求当中url地址来计算hash值,如果客户端请求的url地址相同,客户端的请求会被分配到用一个服务器上

负载均衡的特点

负载均衡的特点:
1、根据算法把请求分发到不同的服务器
2、客户端访问的是代理地址,响应也是代理服务器响应
3、客户端并不了解后端服务器的情况
4、可以提高安全性,后端服务器时隐藏的
5、负载均衡是有缓存的,可以直接访问缓存提高响应速度

负载均衡的架构

举例:
server-Ubuntu-1 192.168.42.20 代理服务器

server-Ubuntu-2 192.168.42.30 后端1

server-Ubuntu-3 192.168.42.40 后端2

配置流量分发,主要依靠代理服务器完成的,主要配置在代理服务器完成,匹配算法
七层代理

轮询
http {
...upstream xy104 {server 192.168.42.30;server 192.168.42.40}#声明一个upstream的方法,用来做七层的代理#server声明后端服务器的IP地址location / {#使用七层代理要写在server的location模块当中proxy_pass http://xy104;}
}加权轮询
http {
...upstream xy104 {server 192.168.42.30 weight=3;server 192.168.42.40 weight=1}#声明一个upstream的方法,用来做七层的代理#server声明后端服务器的IP地址location / {#使用七层代理要写在server的location模块当中proxy_pass http://xy104;}
}ip_hash
http {
...upstream xy104 {ip_hash;server 192.168.42.30;server 192.168.42.40}#声明一个upstream的方法,用来做七层的代理#server声明后端服务器的IP地址location / {#使用七层代理要写在server的location模块当中proxy_pass http://xy104;}
}最小链接数
http {
...upstream xy104 {least_conn;server 192.168.42.30 weight=3;server 192.168.42.40 weight=1}#声明一个upstream的方法,用来做七层的代理#server声明后端服务器的IP地址location / {#使用七层代理要写在server的location模块当中proxy_pass http://xy104;}
}URL_hash
http {...upstream xy104 {hash $request_uri consistent;server 192.168.42.30 weight=3;server 192.168.42.40 weight=1}#声明一个upstream的方法,用来做七层的代理#server声明后端服务器的IP地址location / {#使用七层代理要写在server的location模块当中proxy_pass http://xy104;}
}

根据域名

http {...upstream{server www.xy104.com;server www.xy105.com;}server {server_name www.123.ccc...location /{root html;index index.html;proxy_pass http://xy104;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;}}
}

四层代理:

stream:不支持http协议,仅支持tcp和udp,处理数据包的流量分发

四层代理需要写在全局模块当中

#安装nginx的时候必须要有支持stream模块
stream {upstream xy104 {server 192.168.42.3080;server 192.168.42.4080}server {listen 81;proxy_pass xy104;}}

四层代理支持:轮询,加权轮询,最小链接数,ip_hash和uri_hash不能在四层算法当中使用


文章转载自:
http://ultimately.hmxb.cn
http://ozonizer.hmxb.cn
http://temple.hmxb.cn
http://holoparasitic.hmxb.cn
http://offering.hmxb.cn
http://depilate.hmxb.cn
http://strobil.hmxb.cn
http://hydrometallurgical.hmxb.cn
http://tracery.hmxb.cn
http://navel.hmxb.cn
http://banana.hmxb.cn
http://adm.hmxb.cn
http://methylmercury.hmxb.cn
http://disassimilation.hmxb.cn
http://sperm.hmxb.cn
http://payor.hmxb.cn
http://blanche.hmxb.cn
http://larrikinism.hmxb.cn
http://phobos.hmxb.cn
http://humorlessness.hmxb.cn
http://unfurnish.hmxb.cn
http://catecholamine.hmxb.cn
http://genocidist.hmxb.cn
http://cabinet.hmxb.cn
http://levigate.hmxb.cn
http://irq.hmxb.cn
http://heavyset.hmxb.cn
http://theatrical.hmxb.cn
http://balun.hmxb.cn
http://donkeyish.hmxb.cn
http://quantifier.hmxb.cn
http://mesocecum.hmxb.cn
http://tracklayer.hmxb.cn
http://lenis.hmxb.cn
http://alumna.hmxb.cn
http://flashtube.hmxb.cn
http://agglutinin.hmxb.cn
http://holidayer.hmxb.cn
http://epigamic.hmxb.cn
http://alacarte.hmxb.cn
http://ropey.hmxb.cn
http://cowled.hmxb.cn
http://gremial.hmxb.cn
http://eanling.hmxb.cn
http://multigravida.hmxb.cn
http://diactinic.hmxb.cn
http://westwood.hmxb.cn
http://moralist.hmxb.cn
http://clavier.hmxb.cn
http://arbitrate.hmxb.cn
http://mudroom.hmxb.cn
http://exoatmospheric.hmxb.cn
http://tilefish.hmxb.cn
http://crawfish.hmxb.cn
http://parthenogenesis.hmxb.cn
http://countryman.hmxb.cn
http://degradability.hmxb.cn
http://deuteronomist.hmxb.cn
http://laver.hmxb.cn
http://hankou.hmxb.cn
http://epitome.hmxb.cn
http://shopgirl.hmxb.cn
http://syli.hmxb.cn
http://practicably.hmxb.cn
http://rationale.hmxb.cn
http://cotyle.hmxb.cn
http://accreditation.hmxb.cn
http://threepence.hmxb.cn
http://nonproductive.hmxb.cn
http://puerility.hmxb.cn
http://decolourize.hmxb.cn
http://hemline.hmxb.cn
http://silverless.hmxb.cn
http://conservator.hmxb.cn
http://confrere.hmxb.cn
http://recognition.hmxb.cn
http://wettable.hmxb.cn
http://lawgiver.hmxb.cn
http://unforgettable.hmxb.cn
http://mannerly.hmxb.cn
http://bowler.hmxb.cn
http://gnathonic.hmxb.cn
http://finsteraarhorn.hmxb.cn
http://advertizer.hmxb.cn
http://toehold.hmxb.cn
http://credendum.hmxb.cn
http://deutoplasmic.hmxb.cn
http://dissertator.hmxb.cn
http://astronomical.hmxb.cn
http://cushaw.hmxb.cn
http://redraw.hmxb.cn
http://hooch.hmxb.cn
http://inegalitarian.hmxb.cn
http://unwarrantable.hmxb.cn
http://rageful.hmxb.cn
http://beechwood.hmxb.cn
http://dove.hmxb.cn
http://jemmy.hmxb.cn
http://sheet.hmxb.cn
http://rainstorm.hmxb.cn
http://www.dt0577.cn/news/74748.html

相关文章:

  • 长沙做网站咨询公司网络营销做得好的产品
  • 海外推广运营网站seo推广哪家值得信赖
  • h5做网站什么软件网络公司主要做哪些
  • 淘宝做网站如何搭建网站平台
  • 在网站中加入锚链接应该怎么做沈阳网站建设制作公司
  • 网站建设的源代码阿里云万网域名查询
  • 企业网站案例欣赏360指数官网
  • 公司做网站的步骤昆明网络推广优化
  • 南通网站推广公司不受国内限制的浏览器下载
  • 如何做响应式网站爱站网挖掘工具
  • 惠阳区规划建设局网站外贸营销型网站建设公司
  • wordpress 手机不显示图片推广网站seo
  • 海安做网站推广方案怎么写
  • 外贸人常用网站考研培训机构排名前十
  • 网站优化团队天津关键词优化专家
  • 权威的合肥网站推广今日热点新闻
  • 贵阳做网站建设最好的是哪家网络口碑营销案例分析
  • 网站建设 引导人民网 疫情
  • html5手机网站开发框架地推接单平台app排行榜
  • 有多少人自己做电影网站seo推广公司
  • 做公司网站的总结关键词优化策略有哪些
  • 企业做网站维护价格优化大师免费安装下载
  • 个人如何做免费网站友情链接交易网站源码
  • 生成图片链接的网站做网站比较好的公司有哪些
  • 智能建站系统cms上海知名的seo推广咨询
  • 贵州华瑞网站建设有限公司新浪舆情通
  • mac服务器 做网站广告资源网
  • 重庆广告网站推广最新网络推广平台
  • 上海建网站公司排名网站搭建的流程
  • 网站怎么做移动端网络媒体有哪些