鍍金池/ 問答/Linux/ 阿里云ECS同一服務器下的不同域名ping出了不同的IP?

阿里云ECS同一服務器下的不同域名ping出了不同的IP?

我在阿里云ECS服務器上配置https多站點的時候,遇到了這樣的問題:
這是nginx的配置文件:

server {
        listen       443 ssl;
        server_name  domain1;
        ssl on;
        root /usr/local/nginx/html;
        ssl_certificate      cert/domain1.pem;
        ssl_certificate_key  cert/domain1.key;
        index index.php index.html index.htm
        ssl_session_timeout  5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers  on;

         location ~ \.php {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            index index.php index.html index.htm;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/$fastcgi_script_name;
            fastcgi_connect_timeout 300;
            fastcgi_send_timeout 300;
            fastcgi_read_timeout 300;
            include fastcgi_params;
       }


    }
    server {
        listen 443;
        server_name domain2;
        ssl on;
        ssl_certificate     cert/1_domain2_bundle.crt;
        ssl_certificate_key cert/2_domain2.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers on;
         location ~ \.php {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/dzt666/phphelper/public/$fastcgi_script_name;
            root   /usr/local/nginx/html/dzt666/phphelper/public;
            index  index.php index.html index.htm;
        }
    }
server {
        listen 443;
        server_name domain3;
        root   /usr/local/nginx/html/dzt666/lostandfound/public/;
        index  index.php index.html index.htm;
        ssl on;
        ssl_certificate     cert/1_domain3_bundle.crt;
        ssl_certificate_key cert/2_domain3.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers on;
        location ~ \.php {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/dzt666/lostandfound/public/$fastcgi_script_name;
            #root   /usr/local/nginx/html/dzt666/lostandfound/public/;
            #index  index.php index.html index.htm;
        }
    }

這是在終端ping出的結果:

[root@localhost ~]# ping domain1
PING domain1.w.kunlungr.com (123.12.123.188) 56(84) bytes of data.
64 bytes from 123.12.123.188.broad.km.yn.dynamic.163data.com.cn (123.12.123.188): icmp_seq=1 ttl=48 time=11.5 ms
^C
--- domain1.w.kunlungr.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.512/11.512/11.512/0.000 ms
[root@localhost ~]# ping domain2
PING domain2.w.kunlunar.com (123.12.123.188) 56(84) bytes of data.
64 bytes from 188.241.55.116.broad.km.yn.dynamic.163data.com.cn (123.12.123.188): icmp_seq=1 ttl=48 time=12.3 ms
^C
--- domain2.w.kunlunar.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 12.304/12.304/12.304/0.000 ms
[root@localhost ~]# ping domain3
PING domain3.w.kunlungr.com (123.12.123.183) 56(84) bytes of data.
64 bytes from 183.241.55.116.broad.km.yn.dynamic.163data.com.cn (123.12.123.183): icmp_seq=1 ttl=48 time=6.94 ms
64 bytes from 183.241.55.116.broad.km.yn.dynamic.163data.com.cn (123.12.123.183): icmp_seq=2 ttl=48 time=8.34 ms
^C
--- domain3.w.kunlungr.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 6.943/7.643/8.343/0.700 ms
[root@localhost ~]# 

domain1能正常訪問,domain3不能正常訪問,請教各位前輩,我的配置哪里出了問題,該怎么來處理這類的問題?

回答
編輯回答
青瓷

ping 跟 nginx 沒有任何關系。
域名和 IP 的問題先查 DNS 。

2018年3月1日 12:06
編輯回答
奧特蛋

你ping的是指向到阿里云CDN的域名,域名直接A記錄指向到ECS的IP就OK了

2017年1月15日 12:47