[原创]访问未备案的阿里云服务器上搭建的网站
时间:2014-05-09 07:58:45
收藏:0
阅读:470
最近租了个阿里云服务器玩,因为没有备案,直接通过IP是无法访问网站的,所以自己摸索出了一种临时访问未备案的阿里云服务器上搭建的网站的方法.
原理很简单,阿里云会判断访问服务器的域名是否已备案,若已备案,则跳转到阿里云内部相应ip的服务器,所以我们只需要找一个阿里云备案过的域名(直接在阿里云的成功案例里面找),这里提供两个:www.php-z.com, www.pipaw.com,然后我们只需更改C:\Windows\System32\drivers\etc下的hosts文件,我的更改如下:
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a ‘#‘ symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 218.244.148.171 www.php-z.com 115.29.204.221 www.pipaw.com 127.0.0.1 localhost
这样,我访问www.pipaw.com和www.php-z.com就可以访问我们自己的阿里云服务器了.
评论(0)