码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-08-19 20:55:12      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:一次接口网站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文件

user  www www;

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;

    #gzip  on;

   #172.18.18.217 

   upstream 172.18.18.217{

    server 172.18.18.217:80;

   }

    server {

        listen       80;

        server_name  test.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        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_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

        #

        #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;

    #    }

    #}

}


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://250919938.blog.51cto.com/962010/1686160

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

标签:一次接口网站iis6切换成iis7失误造成的影响

原文地址:http://250919938.blog.51cto.com/962010/1686160

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!