发表于 2018-12-8 11:11:56

一次接口网站IIS6切换成IIS7失误造成的影响

  首先上环境:
  原接口网站服务器windows2003R2 32bit   IIS6.0
  新服务器windows2008R2 64bit          IIS7.0
  网站前端用nginx做反向代理
  1;操作步骤
  首先把站点拷贝到新服务器上
  这一步没有什么问题 一个ftp搞定 另外我们网站环境用了一个同步源 sersync2--rsync的操作 所以并不影响了开发传代码
  2;测试
  本机修改hosts 路径为C:\Windows\System32\drivers\etc
  192.168.1.50 www.AAA.com
  ##这步相当关键,之后因为这里测试不严谨导致一系列故障
  3;修改nginx配置文件
  ##附上我做nginx反向代理测试的config文件
  userwww www;
  worker_processes1;
  #error_loglogs/error.log;
  #error_loglogs/error.lognotice;
  #error_loglogs/error.loginfo;
  #pid      logs/nginx.pid;
  events {
      worker_connections1024;
  }
  http {
      include       mime.types;
      default_typeapplication/octet-stream;
      #log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
      #                  '$status $body_bytes_sent "$http_referer" '
      #                  '"$http_user_agent" "$http_x_forwarded_for"';
      #access_loglogs/access.logmain;
      sendfile      on;
      #tcp_nopush   on;
      #keepalive_timeout0;
      keepalive_timeout65;
      #gzipon;
     #172.18.18.217
   upstream 172.18.18.217{
      server 172.18.18.217:80;
     }
      server {
        listen       80;
        server_nametest.com;
        #charset koi8-r;
        #access_loglogs/host.access.logmain;
        location / {
              proxy_pass          http://172.18.18.217;
              proxy_set_header    Host            $host;
              proxy_set_header    X-Real-IP       $remote_addr;
              proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        #error_page404            /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
        #
        #location ~ \.php$ {
        #    root         html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_indexindex.php;
        #    fastcgi_paramSCRIPT_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 {
        #    denyall;
        #}
      }
      # another virtual host using mix of IP-, name-, and port-based configuration
      #
      #server {
      #    listen       8000;
      #    listen       somename:8080;
      #    server_namesomenamealiasanother.alias;
      #    location / {
      #      root   html;
      #      indexindex.html index.htm;
      #    }
      #}
      # HTTPS server
      #
      #server {
      #    listen       443 ssl;
      #    server_namelocalhost;
      #    ssl_certificate      cert.pem;
      #    ssl_certificate_keycert.key;
      #    ssl_session_cache    shared:SSL:1m;
      #    ssl_session_timeout5m;
      #    ssl_ciphersHIGH:!aNULL:!MD5;
      #    ssl_prefer_server_cipherson;
      #    location / {
      #      root   html;
      #      indexindex.html index.htm;
      #    }
      #}
  }
  

  4;另准备一台nginx反向代理服务器,跟源nginx配置文件一模一样
  ##这个当时没考虑到,但是因为以前我就做个一个在线上的nginx服务器的备份服务器 线上服务器和备用服务器没有采取高可用,但是也同时利用了sersync2---rsync,之后出问题的时候我才知道自己有多明智(搞不定之后,我用了这台备用的nginx--原网站接口服务器)
  

  5;正式切换
  其实也就是在线上nginx服务器上将原来的 upstream更换成另外一个而已不叙述了,nginx反带不难 这里有个相当重要的操作就是一定要
  ./nginx -t 检测配置文件写的是否正确,再reload加载 我们这一步相当的严谨做了
  

  问题爆发
  1;我们切换过去之后发现 网站刚刚还能打开,之后就不能够打开了
  突然一下 20~30个网站接口全挂了,开发全部来找我,自己说实话也慌了。
  解决:我们发现了一个让人哭笑不得的问题,新的服务器被我们安装了一个服务器安全狗 所以你懂的。nginx反向代理和负载 后端web服务器又防火墙的话一定要加个白名单
  这里在切换之后或者在切换之前再弄一台nginx反带用ab测试 分别测试不同的网站接口(nginx有缓存功能,如果一直用ab测试相同的网站并无意义,可能还需要多台ab客户端)
  

  2;突然冒出以一个网站接口打开报错
  说实话,我对网站代码报错也不懂,开发一个劲的找我(他也是从别人手上接手的代码,还没看过的) 之后一个开发查了下报错信息发现这个程序需要.net3.5环境 问我安装了没有
  我说没有,情况可想而知
  这里一说明我们测试(上面第2步)并不严谨二说明我们配置服务器环境的时候也没考虑到位
  

  3;开发给了我一个建议说从32位系统搬迁到64位上 最好在IIS7上还是使用32位的.net环境不然里面出现了些异常更加难查 更改如下图
http://s3.运维网.com/wyfs02/M02/71/9C/wKiom1XUYe-hRKN5AAIVb0pZuGc156.jpg
  一次简单的网站切换竟然导致了这么多问题,细节很重要啊。
  

  




页: [1]
查看完整版本: 一次接口网站IIS6切换成IIS7失误造成的影响