一次线上Nginx出问题排错经历

强烈推荐一个大神的人工智能的教程:http://www.captainbed.net/zhanghan

【前言】

    我们最近新上线一个新的功能是对题库的查询和练习,我们是在微信公众号中挂载的阿里云,阿里云反向代理到我们的机房中。

【一次排错的经历】       

    线上环境出问题自然对我们的影响十分大的,不敢稍有怠慢赶紧进行相关排查;

    一、一次访问的流程:

        微信公众号——>阿里Nginx——>机房公网——>机房内网——>机房Nginx——>机房应用服务器;

    二、出现的现象:       

        1.公众号中的挂载的功能访问不了;

        2.在我们机房用有线连不上阿里服务器只能用无线进行连接;   

    三、排查过程:    

        A.定位问题

          1.排除应用本身问题:

            直接访问局域网中应用可以访问到,说明不是应用内网部署的问题;

          2.排除网络中映射问题:

            访问机房内网映射外网对应的地址,也是可以访问通的;说明不是映射问题;

          3.排除阿里上的问题:

            访问阿里对应的应用地址,访问不通;说明是阿里到机房公网这个环节肯定有问题;

        B.寻找原因:

          1.进行测试:

           (1)看阿里的Nginx打出的日志一直是机房对应的外网地址拒绝连接

           (2)在线上用服务器去ping阿里服务器不能ping通

           (3)用阿里的服务器去ping公网的IP能ping通

          2.根据测试定可能原因:

           (1)阿里本身的Nginx或网有问题

           (2)我们机房内网将阿里服务器的IP屏蔽了

          3.进行验证:

           (1)测试阿里本身Nginx或网问题:

                首先在阿里的Nginx上做了代理百度的测试,发现没有问题说明阿里及本身的Nginx没有问题;

           (2)机房内网将阿里服务器屏蔽:               

                另外的一台阿里云服务器上装上Nginx代理到我们的机房,发现可以代理到,确定是我们机房的网的措施应该被屏蔽掉了;

          4.临时解决办法:

            由于网络核对还需要走审批,需要一定的时间,我们临时的快速的解决办法是让阿里Nginx代理到另外的阿里的Nginx代理到我们的机房中这条路,这样是可以的。

          5.最终解决办法:

            网络的人员检查网后,进行了相关设置;我们可以从内网上可以直接远程上阿里的服务器后,然后将阿里的服务器再改回来,这时可以正常代理到;

【总结】

     1.在开发阶段预想到的情况在线上环境都会出现,而且在线上环境出有些问题是在开发阶段预想不到的;

     2.由1可以得出在线上总会出些不在预料之内的问题,如何快速解决问题那?    

      (1)出问题后将问题进行逐步的分解

      (2)在各个环节验证问题是出在哪里

当年的春天 CSDN认证博客专家 分布式 Spring Redis
6年Java互联网研发经验,坐标北京;擅长微服务和中间件。
已标记关键词 清除标记
<div class="post-text" itemprop="text"> <p>We are running a service which will migrate the issues from Jira to test link.So I am using nginx server to communicate with mysql database and to run the testlink in the browser.</p> <p>when I import more no of issue suddenly the nginx server get closed automatically.I am running my service and nginx server in Windows server 2008 R2 standard and 64 bit OS. I checked the error.log file in the <code>C: ginx\logs</code> and found the error as</p> <blockquote> <p>upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 192.168.27.151, server: localhost, request: "GET /testlink/lib/general/frmWorkArea.php?feature=reqSpecMgmt HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wo-qatestlink01", referrer: "<a href="http://wo-qatestlink01/testlink/lib/general/navBar.php?tproject_id=0&tplan_id=0&updateMainPage=1" rel="nofollow">http://wo-qatestlink01/testlink/lib/general/navBar.php?tproject_id=0&tplan_id=0&updateMainPage=1</a>"</p> </blockquote> <p>Thanks.</p> <p><strong>Log File</strong></p> <pre><code>#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; proxy_read_timeout 600; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.php; fastcgi_read_timeout 600; #The above line has been added and below line has been commented to use the php code. #index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # ########## Code added during Configuration By Anthony ################ location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME c:/nginx/html/$fastcgi_script_name; include fastcgi_params; } ###################################################################### #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } </code></pre> </div>
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__0809 返回首页
实付 9.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值