阿里云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不能正常访问,请教各位前辈,我的配置哪里出了问题,该怎么来处理这类的问题?

阅读 3.9k
2 个回答

ping 跟 nginx 没有任何关系。
域名和 IP 的问题先查 DNS 。

新手上路,请多包涵

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题