【发布时间】:2011-10-04 00:05:22
【问题描述】:
我最近删除了 MAMP。
当我尝试从终端启动 apache 时:
sudo apachectl -k restart
我收到消息
Warning: DocumentRoot [usr/docs/dummy-host.example.com] does not exist.
【问题讨论】:
标签: apache macos terminal mamp
我最近删除了 MAMP。
当我尝试从终端启动 apache 时:
sudo apachectl -k restart
我收到消息
Warning: DocumentRoot [usr/docs/dummy-host.example.com] does not exist.
【问题讨论】:
标签: apache macos terminal mamp
您可能需要转到 apache 配置文件(类似于etc/apache2/apache2.conf)并将其设置为现有的文档根目录。这通常使用此文件中的 DocumentRoot 指令或包含的虚拟主机配置定义之一来完成。
【讨论】:
首先,通过发出以下命令,确保您实际上是在尝试执行正确版本的 apachectl:
which apachectl
(您不想在那里看到任何 MAMP 引用)。
接下来,找到您的虚拟主机配置(如果您的 MAMP 引用不存在,则可能在此处)
/etc/apache2/extra/httpd-vhosts.conf
确保您的虚拟主机定义良好。 (听起来你在引用一个坏的)。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/Users/yourusername/Sites/mysite"
ServerName mysite.local
ErrorLog "/private/var/log/apache2/mysite-error_log"
CustomLog "/private/var/log/apache2/mysite-access_log" common
</VirtualHost>
(如果您使用的是我上面定义的“localhost”以外的自定义服务器名称,请确保您的 /etc/hosts 文件与该条目是最新的,如下所示:
127.0.0.1 mysite.local
别忘了重启apache!
sudo apachectl restart
【讨论】:
确保注释掉 /etc/apache2/extra/httpd-vhosts.conf 文件中的所有行,否则会出现错误。
【讨论】: