新的 Azure VM 说 InvalidQueryParameterValue comp

New Azure VM says InvalidQueryParameterValue comp

我创建了一个新的 Azure VM,安装了 LAMP 堆栈,当我在浏览器中访问该域名时,出现以下错误,我无法通过 Google 或堆栈溢出:

<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidQueryParameterValue</Code><Message>Value for one of the query parameters specified in the request URI is invalid.
RequestId:45ba52f4-0001-0086-13ed-e545cf000000
Time:2015-09-03T02:07:58.4816344Z</Message><QueryParameterName>comp</QueryParameterName><QueryParameterValue /><Reason /></Error>

当我在通过 SSH 登录时使用 wget http://localhost 时,我得到了这个错误:

--2015-09-03 02:05:57--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 65 [text/html]
index.html: Permission denied

Cannot write to ‘index.html’ (Permission denied).

默认站点的 apache 配置很简单:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

如何让此 VM 开始使用 Apache 提供服务?

第一个错误(从 Internet 打开时)(很可能)显示您没有尝试访问 VM URL,而是另一个服务(即 Azure 存储服务,或其他一些 Azure 服务)

为了让新手更加困惑,Microsoft 现在有两种并行类型的服务 - 一种称为 classic,另一种称为 resource manager。为了给您最佳答案,我必须知道您是如何创建 VM 的 - 使用 classic 或使用 resource manager(或简称为 ARM)模式。如果它是 clasic,您的 VM 应该位于类似这样的域中:mylinuxvm.cloudapp.net。您可以在管理门户中检查此项,然后选择 VM 并检查其设置/属性。如果是这样的话,您唯一需要添加的是 Endpoint for port 80,这样来自 TCP 端口 80 的互联网流量将被重定向到您的 VM。

如果它是一个 ARM 虚拟机,您需要一个 network security group 规则,将端口 80 上的流量发送到您的 public IP 地址,该地址必须与虚拟机相关联。

第二个错误:

When I use wget http://localhost while logged in through SSH, I get this error instead:

--2015-09-03 02:05:57-- http://localhost/ Resolving localhost (localhost)... 127.0.0.1 Connecting to localhost (localhost)|127.0.0.1|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 65 [text/html] index.html: Permission denied

Cannot write to ‘index.html’ (Permission denied).

你得到是因为你使用的是 wget 而不是 curl。不同之处在于 curl 只会在 stdout 中呈现结果,而 wget 会尝试 下载并保存 内容。错误很明显:

Cannot write to ‘index.html’ (Permission denied).

这意味着您正在一个您没有写入权限的文件夹中执行命令。如果您在执行命令之前没有执行 sudo,这通常是 root 用户的家。

如果您将 CNAME 指向错误的 Azure 服务器,可能会在“Static Website hosting”功能上发生这种情况。

您必须使用名称中包含 web 而不是 blob 的服务器 DNS 名称。