我创建了一个新的Azure VM,安装了LAMP堆栈,当我在浏览器中访问域名时,它会出现以下错误,我无法通过Google或Stack Overflow找到任何信息:
<?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服务)
为了让新用户更加困惑,微软现在有两种并行类型的服务 - 一种叫做classic
,另一种叫做resource manager
。为了给你最好的答案,我必须知道你是如何创建你的VM的 - 使用classic
或使用resource manager
(或简称ARM)模式。如果是clasic,你的VM应该生活在一个类似于:mylinuxvm.cloudapp.net
的域中。您可以检查此信息进入管理门户,然后选择VM并检查其设置/属性。在这种情况下,您需要添加的唯一内容是Endpoint for port 80,以便TCP端口80上的Internet流量将重定向到您的VM。
如果它是ARM VM,则需要network security group规则,该规则将端口80上的流量发送到您的公共IP地址,该IP地址必须与VM关联。
第二个错误:
当我通过SSH登录时使用wget http://localhost时,我收到此错误:
--2015-09-03 02:05:57-- http://localhost/解析localhost(localhost)... 127.0.0.1连接到localhost(localhost)| 127.0.0.1 |:80 ...已连接。发送HTTP请求,等待响应... 200 OK长度:65 [text / html] index.html:权限被拒绝
无法写入'index.html'(权限被拒绝)。
你得到因为你使用wget
而不是curl
。不同的是,curl
只会在stdout
中呈现结果,而wget
会尝试降低并保存背景。错误很明显:
无法写入'index.html'(权限被拒绝)。
这意味着您在没有写入权限的文件夹中执行该命令。在执行命令之前不执行sudo时,这通常是root用户的主页。
如果您将CNAME指向错误的Azure服务器,则可能会在新的“Static Website hosting”功能上发生这种情况。
您必须使用包含“web”的服务器域名,而不是“blob”。
我错误地这样做了,因为它说“在这里或在这里指出”,我认为它们是等同的,而不是用于完全不同的目的。