【问题标题】:Error starting apache from terminal after removing MAMP删除 MAMP 后从终端启动 apache 时出错
【发布时间】: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


    【解决方案1】:

    您可能需要转到 apache 配置文件(类似于etc/apache2/apache2.conf)并将其设置为现有的文档根目录。这通常使用此文件中的 DocumentRoot 指令或包含的虚拟主机配置定义之一来完成。

    【讨论】:

      【解决方案2】:

      首先,通过发出以下命令,确保您实际上是在尝试执行正确版本的 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
      

      【讨论】:

      • 这似乎很明显,因为我读到了这篇文章......但与此同时,我不可能自己弄清楚所有这些步骤......谢谢!
      • 第一次在 mac 上配置 apache 时错过了。但感谢上帝最终像一个魅力一样工作!!!
      【解决方案3】:

      确保注释掉 /etc/apache2/extra/httpd-vhosts.conf 文件中的所有行,否则会出现错误。

      【讨论】:

        猜你喜欢
        • 2018-03-27
        • 1970-01-01
        • 2016-09-28
        • 1970-01-01
        • 1970-01-01
        • 2021-04-10
        • 2014-06-08
        • 1970-01-01
        • 2015-11-08
        相关资源
        最近更新 更多