本文介绍了MAMP:本地主机的index.html在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MAMP的默认index.html(它起作用了!")文件安装在哪里?

Where is MAMP's default index.html ("It works!") file installed?

我的MAMP安装适用于localhost:8888.但是,当我只键入"localhost"时,无法找到(在我的机器上)提供的index.html.

My MAMP installation works fine for localhost:8888. However I am unable to find (on my machine) the index.html that is served when I type just "localhost".

我专门查看了/opt/local/apache2/htdocs和/Applications/MAMP/htdocs中的内容,并更改了在那里找到的index.html文件.但是,localhost继续显示有效!"没别的.我什至将其重命名为index.html,但它有效!"仍然显示.

I looked specifically in /opt/local/apache2/htdocs and in /Applications/MAMP/htdocs and changed the index.html files that I found there. However, localhost keeps displaying "It works!" and nothing else. I even renamed index.html but "It works!" is still displayed.

根据我的httpd.conf文件,文档根目录为"/Applications/MAMP/htdocs".

According to my httpd.conf file, document root is "/Applications/MAMP/htdocs".

那么,MAMP的默认index.html文件安装在哪里?

SO, where is MAMP's default index.html file installed?

推荐答案

将浏览器指向"localhost"时,您会看到OS X Apache Server(如果正在运行)的响应.这个行得通!"文件位于/Library/WebServer/Documents中.

When you point your browser to "localhost" you're seeing the response of OS X Apache Server (if running, that is). This "It works!" file resides in /Library/WebServer/Documents.

建议关闭OS X Apache Server并改用MAMP的服务器.在OS X 10.11之前的版本中,共享选项"(Web共享)中有一个首选项可以将其打开/关闭.在El Capitan上,您必须打开一个终端并输入以下内容之一:

It's advisable to turn off OS X Apache Server and use MAMP's one instead. On OS X versions before 10.11 there's a preference in Sharing Options (Web Sharing) to turn it On/Off. On El Capitan you have to open a Terminal and write one of these:

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

如果您使用MAMP,只需将您的项目放在MAMP/htdocs中,就可以了.您可以通过"localhost:8888/your_project"访问它们.

If you work with MAMP just put your projects in MAMP/htdocs and you'll be fine. You can access them thru "localhost:8888/your_project".

希望有帮助.

这篇关于MAMP:本地主机的index.html在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 19:00