谷歌计算引擎云DNS访问问题 - 网页不可用

时间:2014-12-15 02:28:34

标签: apache google-app-engine dns google-compute-engine

而不是负面投票,如何告诉我为什么。 。 。

我已经设置了一个Web服务器,并在LAMP堆栈上上传了一些网页。我可以通过IP地址访问。我将我的域名主机设置为指向云dns。我启用了云DNA api。我的问题是域名没有加载网站,只返回"此网页不可用/ DNS查找失败"我已经阅读并尝试了很多不同的选择。没运气。其他信息:


sudo apache2ctl -S返回:

VirtualHost configuration:  
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
     default server lamp-6kvi.c.united-yeti-790.internal (/etc/apache2/sites-enabled/lamp-server:1)
     port 80 namevhost lamp-6kvi.c.united-yeti-790.internal (/etc/apache2/sites-enabled/lamp-server:1)
     port 80 namevhost example.com (/etc/apache2/sites-enabled/lamp-server:28)
     port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com:1)
Syntax OK

配置文件/etc/apache2/sites-available/example.com读取:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/websitedirectory
    <Directory /var/www/websitedirectory/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    ErrorLog /var/log/apache2/mysite-error.log
    CustomLog /var/log/apache2/mysite-access.log common


cloud dns managed-zone list返回:

[
{
    "creationTime": "2014-12-14T15:40:29.066Z",
    "description": "",
    "dnsName": "example.com.",
    "id": "2608871832699155245",
    "kind": "dns#managedZone",
    "name": "exampledns",
    "nameServers": [
        "ns-cloud-d1.googledomains.com.",
        "ns-cloud-d2.googledomains.com.",
        "ns-cloud-d3.googledomains.com.",
        "ns-cloud-d4.googledomains.com."
    ]
}]

我没有尝试删除灯泡服务器,默认或注释掉其他文件。 。 。请帮忙。

2 个答案:

答案 0 :(得分:1)

要扩展您自己的答案,(通过使用Web控制台),您应该:

  1. 转到 your GCE Console ,然后 选择你的项目。
  2. 创建区域:在左侧菜单中,转到 Networking-&gt; Cloud DNS ,然后“创建区域”。在那里设置域(example.com)和您选择的名称。创建区域后,您将进入区域的记录列表。
  3. 找到 NameServer 寄存器( NS 寄存器类型):您应该看到类似的内容: ns-cloud-c1。 googledomains.com ns-cloud-c2.googledomains.com ......
  4. 使用域名注册商设置这些名称服务器以使域可访问:转到此域所属的注册商(NetworkSolutions / GoDaddy / Any Other),并配置名称您所在域的服务器(NS)。设置你在上一步中找到的4(不要只使用我的例子中的那些,它们对你创建的每个区域都是不同的。)
  5. 将您需要的记录添加到您的区域:返回您的GCE控制台,返回您刚刚在步骤2中创建的区域。单击“添加记录集”。在您的情况下,您需要的是CNAME记录:在DNS NAME中键入“www”,从RESOURCE RECORD TYPE中选择“CNAME”,然后键入“example.com”。作为CANONICAL NAME(注意最后的。)。然后点击“完成”。
  6. 您现在应该将 example.com www.example.com 同时解析为同一个IP。你还需要保持:

    ServerName example.com
    ServerAlias www.example.com
    

    在虚拟主机apache配置中。

    希望它有助于澄清。

答案 1 :(得分:0)

让它工作 - 发现你需要&#34;添加记录集&#34;在将IP指向您的服务器时,为www.example.com和example.com键入a。像我的问题设置虚拟主机,但没有该部分。

希望有人能证实这是正确的方法。无论如何,使用相同的方法将另外4个域添加到同一服务器。 :-D