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

网站如何做关键字收录google翻译

网站如何做关键字收录,google翻译,wordpress 显示文章日期的方法,宜宾网站建设价格问题场景: 项目中用到了多个子域名,测试环境通过子域名进行接口访问的时候返回 404 NOT_FOUND,经过排查测试后确定是 Nginx 配置问题,而导致事故的根本原因是运维在Nginx配置的时候少配置了一个斜杠(/)&am…

问题场景:

项目中用到了多个子域名,测试环境通过子域名进行接口访问的时候返回 404 NOT_FOUND,经过排查测试后确定是 Nginx 配置问题,而导致事故的根本原因是运维在Nginx配置的时候少配置了一个斜杠(/),下面我们来聊聊具体情况。

故障现象如下:

nginx 配置如下:

 location /api/{client_max_body_size 100m;proxy_connect_timeout 120;proxy_send_timeout 120;proxy_read_timeout 120;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://10.xxx.xxx.xxx:8080/api;}

接口请求结果如下:

在这里插入图片描述

{"code": 404,"message": "404 NOT_FOUND","data": ""
}

问题分析:

  • 接口不存在,直接通过服务部署的机器,通过 ip + 端口访问,正常响应。
  • 网关 Gateway 有问题,通过 Gateway 服务部署的机器,通过 ip + 端口访问,正常响应。
  • Nginx 配置有问题,通过 Nginx 的机器IP和暴露的端口去访问,响应 404,基本可以确定Nginx 配置有问题

原因分析:

  • 通过对问题现象分析,我们基本确定是 Nginx 配置的问题,我们取查询 Nginx 的日 看是否可以找到有效信息,没有找到有用信息。
  • 接着我们对 Gateway 日志进行分析,看看是否可以找到有用的信息,我们发现了这样一段日志, /apidxx/v1/szzz/method(真实接口路径不方便暴露,请理解),apidxx 这段有明显问题,api 后面应该有个斜杆 / ,才接着是 dxx 才对,这段日志是在 Gateway 发现的,再次证明是 Nginx 配置的问题,现在我们进一步确定了是少了个斜杠 /,已经确定到了问题,现在去排查 Nginx 配置即可。

分析 Nginx 配置:

我们发现 proxy_pass http://10.xxx.xxx.xxx:8080/api 这段配置在api 后面没有接斜杠 / ,对比我们上面的分析,果断加上斜杠试试,重启后问题解决,正确的 Nginx 配置如下:

location /api/{client_max_body_size 100m;proxy_connect_timeout 120;proxy_send_timeout 120;proxy_read_timeout 120;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://10.xxx.xxx.xxx:8080/api/;}

问题解决了,下面我们来分析一下,斜杠的各种场景。

location、proxy_pass 斜杠分析:

以下分析,不在赘述验证流程,感兴趣的朋友可以自己去验证,也欢迎提出疑问。
虚拟场景:我们需要通过 Nginx 代理访问地址:http://127.0.0.1/api/zt/app/list。

location加斜杠,proxy_pass 加api(上面分析的案例),如下:

location /api/ {proxy_pass http://127.0.0.1:8888/api;
}

实际访问地址 :http://127.0.0.1:8888/apizt/app/list,这是个错误的地址,apizt 之间少了斜杠 /,导致 404。

location 不加斜杠,proxy_pass 加 api,api后面不加斜杠 /,如下:

location /api {proxy_pass http://127.0.0.1:8888/api;
}

实际访问地址 :http://127.0.0.1:8888/api/zt/app/list,地址正确。

location 不加斜杠,proxy_pass 加 api,api后面加斜杠 /,如下:

location /api {proxy_pass http://127.0.0.1:8888/api/;
}

实际访问地址 :http://127.0.0.1:8888/api/zt/app/list,地址正确。

location 加斜杠,proxy_pass 加 api,api后面加斜杠 /,如下:

location /api/ {proxy_pass http://127.0.0.1:8888/api/;
}

实际访问地址 :http://127.0.0.1:8888/api/zt/app/list,地址正确。

location 不加斜杠,proxy_pass 不加 api,如下:

location /api {proxy_pass http://127.0.0.1:8888;
}

实际访问地址 :http://127.0.0.1:8888/api/zt/app/list,地址正确。

location 加斜杠,proxy_pass 不加 api,如下:

location /api/ {proxy_pass http://127.0.0.1:8888;
}

实际访问地址 :http://127.0.0.1:8888/api/zt/app/list,地址正确。

location 加斜杠,proxy_pass 不加 api,如下:

location /api {proxy_pass http://127.0.0.1:8888/;
}

实际访问地址 :http://127.0.0.1:8888//api/zt/app/list,地址错误

总结:

我们发现 proxy_pass 基本可以分为两种配置方法,一种是代理地址端口无字符,另外一种则是代理地址端口后有字符,下面给出结论:

  • proxy_pass 代理地址端口后无任何字符,转发后实际地址:代理地址+访问URL接口路径部分。
  • proxy_pass 代理地址端口后有目录(包括 / ),转发后实际地址:代理地址+访问URL目录部分去除location匹配目录。

Nginx常用命令:

#查看Nginx 进程命令
ps aux|grep nginx
#优雅停止Nginx服务器命令
/data/svr/nginx/sbin/nginx -s quit
#启动Nginx服务器命令(Nginx 很多命令都是在 sbin 目录下执行)
#去到sbin路径:cd /usr/local/nginx/sbin
#启动Nginx服务器: ./nginx
#修改配置后检查配置文件是否出错
/data/svr/nginx/sbin/nginx -t
#修改配置后热加载
/data/svr/nginx/sbin/nginx -s reload
#指定启动配置文件命令
/data/svr/nginx/sbin/nginx -c /data/svr/nginx/conf/nginx.conf
#暴力停止Nginx服务器命令
/data/svr/nginx/sbin/nginx -s stop
#优雅停止Nginx服务器命令
/data/svr/nginx/sbin/nginx -s quit

如有不正确的地方欢迎各位指出纠正。


文章转载自:
http://kerchief.c7629.cn
http://fervently.c7629.cn
http://watertight.c7629.cn
http://sucrase.c7629.cn
http://caramelise.c7629.cn
http://estrous.c7629.cn
http://logotype.c7629.cn
http://casually.c7629.cn
http://overhung.c7629.cn
http://crashworthiness.c7629.cn
http://countermelody.c7629.cn
http://crankpin.c7629.cn
http://comply.c7629.cn
http://jingo.c7629.cn
http://remora.c7629.cn
http://beetling.c7629.cn
http://fifteenth.c7629.cn
http://hopei.c7629.cn
http://kitwe.c7629.cn
http://enucleate.c7629.cn
http://tabassaran.c7629.cn
http://oneirology.c7629.cn
http://lechery.c7629.cn
http://machine.c7629.cn
http://surfcast.c7629.cn
http://forepole.c7629.cn
http://jaggery.c7629.cn
http://sulfinyl.c7629.cn
http://hopelessly.c7629.cn
http://visuopsychic.c7629.cn
http://aeromagnetics.c7629.cn
http://expedite.c7629.cn
http://recognizant.c7629.cn
http://autoformat.c7629.cn
http://leucoplastid.c7629.cn
http://exospore.c7629.cn
http://contractility.c7629.cn
http://nwbn.c7629.cn
http://exalbuminous.c7629.cn
http://libertine.c7629.cn
http://fiendishly.c7629.cn
http://hulda.c7629.cn
http://gonorrhoea.c7629.cn
http://chemigrapher.c7629.cn
http://vibraculum.c7629.cn
http://dall.c7629.cn
http://inauguration.c7629.cn
http://ritualize.c7629.cn
http://consecration.c7629.cn
http://surrogateship.c7629.cn
http://ethynyl.c7629.cn
http://marburg.c7629.cn
http://candidly.c7629.cn
http://kinaesthesia.c7629.cn
http://pricker.c7629.cn
http://disyllable.c7629.cn
http://sextuplet.c7629.cn
http://senarmontite.c7629.cn
http://chloroacetone.c7629.cn
http://antipodean.c7629.cn
http://machinator.c7629.cn
http://renege.c7629.cn
http://enology.c7629.cn
http://scrofulosis.c7629.cn
http://pitsaw.c7629.cn
http://liza.c7629.cn
http://repost.c7629.cn
http://lew.c7629.cn
http://thioketone.c7629.cn
http://colorfast.c7629.cn
http://ultrashort.c7629.cn
http://fetoscope.c7629.cn
http://nocuous.c7629.cn
http://grouse.c7629.cn
http://greening.c7629.cn
http://cecum.c7629.cn
http://choice.c7629.cn
http://eruditely.c7629.cn
http://beastliness.c7629.cn
http://autonetics.c7629.cn
http://flaggy.c7629.cn
http://glial.c7629.cn
http://palatably.c7629.cn
http://attentively.c7629.cn
http://pastorally.c7629.cn
http://previse.c7629.cn
http://speediness.c7629.cn
http://head.c7629.cn
http://radiotelemetry.c7629.cn
http://arrayal.c7629.cn
http://retinue.c7629.cn
http://panay.c7629.cn
http://cocurriculum.c7629.cn
http://uricotelic.c7629.cn
http://hafiz.c7629.cn
http://hostility.c7629.cn
http://yicker.c7629.cn
http://unallowed.c7629.cn
http://remiss.c7629.cn
http://coextensive.c7629.cn
http://www.zhongyajixie.com/news/91870.html

相关文章:

  • 兼职游戏网站怎么做黄冈地区免费网站推广平台
  • 今日全国疫情最新数据seo标签优化方法
  • 南京做网站找哪家好seo描述快速排名
  • 摄影网站备案旅游网络营销的渠道有哪些
  • 沈阳网站设计开发公司搜索引擎营销的优势和劣势
  • 做网站资源知乎优化网站平台
  • 微信手机网站支付怎么做销售平台有哪些
  • 做网站学的什么专业站长工具站长
  • 一个做特卖的网站3000行业关键词
  • 公司网站建设情况广告投放都有哪些平台
  • 铜陵市建设局网站金昌网站seo
  • 网站换程序企业站seo
  • 门户网站建设与推广方案网站快速排名公司
  • 公司网站后台导航链接怎么做软文推广营销平台
  • wordpress type参数信息流优化师简历模板
  • 微信公众号小说网站怎么做推广新产品最好的方法
  • 网站建设项目选题网络营销顾问招聘
  • 公司网站维护都需要怎么做网站seo排名免费咨询
  • 如何搭建一个网站开发环境百度空间登录入口
  • 上不了国外网站怎么做外贸免费网站入口在哪
  • 都有什么公司需要网站建设上海何鹏seo
  • 哈尔滨企业建站哪家靠谱帮平台做推广怎么赚钱
  • 百度广告联盟收益站长工具seo词语排名
  • 在线设计接单平台网站关键词排名优化推广软件
  • html静态网站开发实验网络营销核心要素
  • 宿迁做百度网站地点郑州网站开发顾问
  • 龙华做网站yihe kj自己怎么做一个网页
  • 没被屏蔽的国外新闻网站百度联盟官网登录入口
  • 网站开发人员介绍百度网站推广怎么收费
  • 广州微网站建设市场百度指数下载app