当我尝试通过`http:// localhost/xampp/htdocs/index.html`打开一个HTML文件时,它说无法连接到localhost

use*_*718 4 html xampp

我已经安装了XAMPP,有一个 htdocs文件夹和里面的 index.html文件,当我尝试在浏览器中打开它http://localhost/xampp/htdocs/index.html时说无法连接到localhost.

怎么了 ?

小智 6

代替

 http://localhost/xampp/htdocs/index.html
Run Code Online (Sandbox Code Playgroud)

试试吧

http://localhost/index.html
Run Code Online (Sandbox Code Playgroud)

或者如果index.html保存在htdocs的文件夹中

http://localhost/<folder-name>/index.html
Run Code Online (Sandbox Code Playgroud)


小智 5

htdocs是您的默认文档根目录,因此您必须使用它localhost/index.html来查看该html文件.换句话说,localhost映射到xampp/htdocs,它本身index.html也是如此localhost.您可以通过修改httpd.conf和重新启动服务器来更改文档根目录的位置.


Nic*_*aus 2

您需要正常启动 Apache 服务器,任务栏的信息部分中应该有一个 xampp 图标,使用此工具您可以启动 apache 服务器以及 mysql 数据库(如果需要)