Scotchbox:文档根丢失/与 Vagrant 不同步

Scotchbox: Document root missing / desynced with Vagrant

我正在为 Vagrant 使用 Scotchbox (box.scotch.io)。自从他们上次更新以来,当我尝试在 Apache 中设置我的一些域配置时,我收到一个文档根丢失错误(AH00112:警告:DocumentRoot [/var/www/mypage] 不存在) .我无法真正确定它是自 Scotch 2.0 以来的设置更改,还是 Vagrant 出于某种原因取消了这些文件夹。我的设置如下,

Vagrant 文件路径

config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

Apache 域配置路径

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mypage.dev
        ServerAlias www.mypage.dev
        DocumentRoot /var/www/mypage
</VirtualHost>

000-default 和 scotchbox 配置文件都指向 /var/www/public。我的默认开发文件夹位于 ~username/Development,该文件夹中是我的 Vagrant 文件。

有什么想法吗?
如果我需要提供其他详细信息,请告诉我。

更新:切换到 Docker。厌倦了这个。

我刚刚克隆了 Scotchbox,我的 Vagrant 文件还包含:

config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

我的 Apache 配置 (/etc/apache2/sites-enabled/000-default.conf) 看起来:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我在主机的根目录中有 public 目录,ls -1 打印:

README.md
Vagrantfile
public

它对我有用!

在您的情况下,您需要更新 apache 配置,并且:

DocumentRoot /var/www/public

注意 Vagrantfile 附近有 public 目录。
如果您有目录 mypage - 那么 运行 mv mypage public