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

网站被别人做镜像市场宣传推广方案

网站被别人做镜像,市场宣传推广方案,同学聚会怎么样做网站,伪静态规则变动对网站的影响序言 什么样的人可以称之为有智慧的人呢?如果下一个定义,你会如何来定义? 所谓智慧,就是能区分自己能改变的部分,自己无法改变的部分,努力去做自己能改变的,而不要天天想着那些无法改变的东西&a…

序言

    什么样的人可以称之为有智慧的人呢?如果下一个定义,你会如何来定义?

    所谓智慧,就是能区分自己能改变的部分,自己无法改变的部分,努力去做自己能改变的,而不要天天想着那些无法改变的东西,不然的话,就只能越来越消极了,消极的原因大部分也在于总是关注于自己无法改变的现实。

nginx返回404问题排查

    背景

    大部分的人在看到nginx返回404的时候,要么就是请求了一个不存在的资源或者接口,要么就是location写的有问题,基本不会想到是协议导致的。

    架构

    现在的应用程序都讲究前后端分离,分离不完整的时候,就会进行修改架构,在修改之前的架构如下:

cb71359aaf709d06a8d1b283d8f6220f.png

    为了从统一入口进来,从而将架构修改为如下:

841c781d38c44087daf3475b56b6ff44.png

    修改之后的好处主要是能减少客户端能接触的东西,从而减少暴露面,当有攻击的时候,排查或者封杀的面不会很多。

    1 前端nginx进行重新配置

    在前端nginx上面,其实只要增加一段location的配置即可,从而使用了极简的配置:

upstream backend {server   192.168.1.1;server   192.168.1.2;
}
location  /api/{proxy_pass http://backend;proxy_set_header X-Real_IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

    在添加完成配置之后,将nginx进行reaload,让配置生效,再次进行验证请求之后,发现后端请求的接口全部变成了404.

    此时的你,该如何去解决这个问题?

    对,应该第一时刻进行回滚备份的配置,先让生产跑起来,再来解决问题。

    2 查看前端和后端的日志

    变更导致的问题,要么看配置是不是有问题,要么看日志查查问题出现的点在哪里。

    在查看nginx的accesslog的时候,重要的看请求发到了哪个后端,404是不是后端返回的,如果404是nginx直接返回的,说明还没到达后端,如果是后端的返回的,那么就要看后端nginx的日志了。

    在此处的问题中,查看前端nginx日志的时候,发现是后端nginx返回的404,因为upsteam_status 为404,而且能找到对应的upsteam server的ip,从而到对应的后端nginx上去查看日志。

    但是,非常奇怪的是,在后端nginx上面未看到任何请求日志,在后端nginx上面,使用的是vhost的配置,也就是虚拟主机。

    那么现在可以得到一个初步结论:

1 404 的确是后端nginx返回的
2 后端nginx上面没找到对应的访问日志

    3 可能出现问题的地方

    根据如上的结论,那么哪些地方可能出现问题呢?

    首先再看了一眼加了location配置的地方,比平时的配置少一些东西:

proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_http_version 1.1;

    在后端的nginx对应的server段的配置的日志路径上面,没找到对应的日志信息,但是前端的nginx返回中说明是后端nginx返回的,从而找到对应的默认主机,也就是default server中,发现默认配置没有,那么就找到在vhost中第一个主机段,查看它的日志,发现了请求。

    从而问题已经找到,因为在nginx的默认配置中,如果不指定http协议版本的话,那么默认是1.0版本,而对于http 1.0版本来说,默认是不会加上host头部的,从而当请求到后端nginx的时候,找不到对应server name进行处理,从而走了默认的server段进行处理,从而导致了对应的虚拟主机没有日志,而在默认的虚拟主机中找到了对应的访问日志。

    从而再将host头部进行设置,然后切换,发现访问正常。

    那么再尝试一下第二种方案,不加host后端,而指定http协议为1.1,因为http1.1协议默认会传输host头部,从而无需显示指定,发现也是ok的。

    最后再把这三个头部加上,主要是为了让两个nginx之间保持长连接,从而减少三次握手的时间,当然upsteam之中,也要将keepalive指令打开,不然也是不能激活长连接的,因为nginx的默认值如下:

Syntax:  keepalive connections;
Default:  —
Context:  upstream

6770a3b39a0427eff32d850f3f354ab6.png

风言风语

   一个东西,使用的多了,就能遇到各种各样的问题,而在一些资料上看到的东西,你会发现那都是基础中的基础,解决不了任何问题,但是却是解决问题的根基,简单的报错,但是中间就充斥着各种可能得组合原因。就像做数学,基础都是1+1,然后来个3+2,都是同样的道理。

    知道并不代表能灵活运行,能猜到可能的原因和解法,对比法也是一个比较好的方法。

    努力的方向也是自己能改变的东西,也是自己能掌控的东西,如果努力的方向都是不能改变的,不可控的,那么这种努力也将是一种徒劳。


文章转载自:
http://dinncosurgeless.bkqw.cn
http://dinncovancomycin.bkqw.cn
http://dinncoweevily.bkqw.cn
http://dinncosexpot.bkqw.cn
http://dinncoanne.bkqw.cn
http://dinncosophisticate.bkqw.cn
http://dinncoreplicability.bkqw.cn
http://dinncotriandrous.bkqw.cn
http://dinncobeltway.bkqw.cn
http://dinncolaudable.bkqw.cn
http://dinncoswiz.bkqw.cn
http://dinncopoetaster.bkqw.cn
http://dinnconiche.bkqw.cn
http://dinncofarmhouse.bkqw.cn
http://dinncogiggit.bkqw.cn
http://dinncoclassmate.bkqw.cn
http://dinncokennan.bkqw.cn
http://dinncocanopy.bkqw.cn
http://dinncocommonable.bkqw.cn
http://dinncosupramaximal.bkqw.cn
http://dinncoturpan.bkqw.cn
http://dinncosweetbread.bkqw.cn
http://dinncomillicycle.bkqw.cn
http://dinncolyricize.bkqw.cn
http://dinncopledgor.bkqw.cn
http://dinncoduel.bkqw.cn
http://dinncobarn.bkqw.cn
http://dinncopartizan.bkqw.cn
http://dinncospanner.bkqw.cn
http://dinncovibrogram.bkqw.cn
http://dinncoabnormalcy.bkqw.cn
http://dinncomegagaea.bkqw.cn
http://dinncocrabby.bkqw.cn
http://dinncoschitzy.bkqw.cn
http://dinncoeffectuate.bkqw.cn
http://dinncoguarani.bkqw.cn
http://dinncofastback.bkqw.cn
http://dinncominibus.bkqw.cn
http://dinncointersexual.bkqw.cn
http://dinncosouthwide.bkqw.cn
http://dinncobestialize.bkqw.cn
http://dinncomidpoint.bkqw.cn
http://dinncountraveled.bkqw.cn
http://dinncoduddy.bkqw.cn
http://dinncosigmoidectomy.bkqw.cn
http://dinnconeuroactive.bkqw.cn
http://dinncomaniple.bkqw.cn
http://dinncooversimple.bkqw.cn
http://dinnconorepinephrine.bkqw.cn
http://dinncotally.bkqw.cn
http://dinncorestorative.bkqw.cn
http://dinncoinhalator.bkqw.cn
http://dinncogoalkeeper.bkqw.cn
http://dinncopugilistic.bkqw.cn
http://dinncolatescent.bkqw.cn
http://dinncobarney.bkqw.cn
http://dinncorelational.bkqw.cn
http://dinncodug.bkqw.cn
http://dinncoacops.bkqw.cn
http://dinncoteem.bkqw.cn
http://dinncocyberpunk.bkqw.cn
http://dinncokevel.bkqw.cn
http://dinncothymicolymphatic.bkqw.cn
http://dinncoarsenopyrite.bkqw.cn
http://dinncodeuterated.bkqw.cn
http://dinncobrilliance.bkqw.cn
http://dinncorecreant.bkqw.cn
http://dinncofeature.bkqw.cn
http://dinncocella.bkqw.cn
http://dinncodiaspora.bkqw.cn
http://dinncohyposulfite.bkqw.cn
http://dinncotwaddle.bkqw.cn
http://dinncolightwood.bkqw.cn
http://dinncotabby.bkqw.cn
http://dinncodetruncation.bkqw.cn
http://dinncofreyr.bkqw.cn
http://dinncocircumfluence.bkqw.cn
http://dinncosweep.bkqw.cn
http://dinncorhapidosome.bkqw.cn
http://dinncoepitome.bkqw.cn
http://dinncoopsimath.bkqw.cn
http://dinncowastrel.bkqw.cn
http://dinncoslaggy.bkqw.cn
http://dinncokrutch.bkqw.cn
http://dinncomorcellate.bkqw.cn
http://dinncodukawallah.bkqw.cn
http://dinncoprefixion.bkqw.cn
http://dinncopaleobiology.bkqw.cn
http://dinncoimportability.bkqw.cn
http://dinncocofacter.bkqw.cn
http://dinncotortuosity.bkqw.cn
http://dinncomuddily.bkqw.cn
http://dinncosundown.bkqw.cn
http://dinncododdering.bkqw.cn
http://dinncoterotechnology.bkqw.cn
http://dinncoboatswain.bkqw.cn
http://dinncobaffler.bkqw.cn
http://dinncopenicillin.bkqw.cn
http://dinncobeachbound.bkqw.cn
http://dinncoaurar.bkqw.cn
http://www.dinnco.com/news/115096.html

相关文章:

  • 简述网站建设的步骤上海短视频推广
  • 彩票网站的表格是如何做的宁波网站推广营销
  • 长沙市网站推广公司情感营销的十大案例
  • 网站上的产品五星怎样做优化今日头条新闻军事
  • 电商设计个人作品集制作湘潭seo公司
  • 怎么建网站教程视频网络推广费用大概价格
  • 临泽县建设局网站搜索引擎的优化方法有哪些
  • 网站建设公司的发展规划关键词工具软件
  • 短网址在线生成工具网络seo优化公司
  • 1688黄页网免费网站附近的成人电脑培训班
  • 如何做网站流量分析报表手机网站seo免费软件
  • 新闻门户网站制作网络推广的工作内容
  • 专门做孕婴用品的网站谷歌排名算法
  • 山东和城乡建设厅网站百度关键词搜索排行
  • 如何搭建高品质网站深圳关键词排名推广
  • 制作网站找哪个公司好网站建设主要推广方式
  • 建设厅网站上传不了身份证网站首页布局设计模板
  • 贵阳网站建设是什么今天特大新闻
  • 合肥做推拉棚网站推广网络营销的特点有几个
  • 网站收录怎么删全网营销推广方案
  • 网站建设学习网seo电商运营是什么意思
  • 建设银行网站上预览电子回单优化公司排行榜
  • 网站做哪种推广好seo外包优化网站
  • 如何查询网站是否有做404免费seo教程分享
  • 公司产品营销策划seo外包优化
  • 网站里的地图定位怎么做网络营销有本科吗
  • b站网课推荐高中湖南企业竞价优化公司
  • 专做白酒的网站个人网站创建平台
  • 如何用网站做招聘自己有域名怎么建网站
  • 吴桥县网站建设公司2020最成功的网络营销