为什么我的本地Apache无法打开html页面?
因此,我正在笔记本电脑上运行Apache。
如果我转到"本地主机",则会显示以下页面:
If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
除了,我无法添加内容并替换该页面。
我可以单击其链接,并且效果很好。
首先,该目录中甚至没有" index.html"文档。如果尝试直接访问使用localhost / index.html创建的地址,则会收到"在服务器上找不到请求URL"。因此,我什至不确定该页面的来源。我已经在apache目录下的该页面中搜索了单词,但没有任何反应。它似乎重定向到某个地方。
就像测试一样,我知道它会加载localhost / manual / index.html(无关紧要),所以我尝试用我写的东西替换它,并且收到消息
The server encountered an internal error or misconfiguration and was unable to complete your request.
错误日志显示,
[Fri Sep 12 20:27:54 2008] [error] [client 127.0.0.1] Syntax error in type map, no ':' in C:/Program Files/Apache Group/Apache2/manual/index.html for header \r\n
但是,如果我直接使用浏览器打开该页面,效果很好。
所以,基本上,我不知道我在这里不知道的东西。我不确定apache在寻找什么。我不确定该错误是否在我的配置文件,html页面或者其他内容中。
哦,我要使用apache来打开它的原因是(主要是)因为我正在尝试测试一些php,所以我试图让apache在本地运行。
谢谢。
解决方案
回答
"默认情况下,页面应放置在Apache 2.0的" C:\ Program Files \ Apache Group \ Apache2 \ htdocs"文件夹中,并放置在" C:\ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs"文件夹中Apache 2.2. 站点准备就绪后,只需删除文件夹中的现有文件,然后将其替换为要测试的文件即可。"
从这里。
回答
好的,
回答我自己的。 。我发现配置文件中的" Listen"伪指令已设置为" Listen 80",而不是" Listen localhost:80"。
另外,localhost / htdocs / index.html不起作用,但是localhost / index.html起作用。
希望这可以在将来对某人有所帮助。
谢谢,施罗德。