Vagrant添加了webroot'文件夹到我的开发环境

时间:2016-07-15 15:44:14

标签: vagrant puppet vagrantfile

我刚刚开始学习如何在我的开发环境中使用vagrant,并且我遇到了烦恼。

当我在项目的根目录中vagrant up时,它会添加一个webroot文件夹,这不是我之后的事。

Vagrant给了我以下结构,随机的webroot文件夹,我认为这与sym_links有关,但没有任何谷歌搜索给我一个答案

| ProjectName ~ Main Project Folder
-| .vagrant ~ Vagrant folder
-| puppet ~ Puppet Configuration Folder
-| vendor ~ Composer vendor folder
-| webroot ~ Randomly added folder :/
- .gitignore
- composer.json
- composer.lock
- Vagrantfile

我的Vagrantfile

Vagrant.configure("2") do |config|

  config.vm.define "aws-control" do |namechase|
  end

  # Enable the Puppet provisioner, with will look in manifests
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "puppet/manifests"
    puppet.manifest_file = "default.pp"
    puppet.module_path = "puppet/modules"
  end

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "ubuntu/trusty64"

  # Forward guest port 80 to host port 80 and name mapping
  config.vm.network :forwarded_port, guest: 80, host: 80

  config.vm.network "public_network",
                    ip: "192.168.0.61",
                    bridge: "en0: Ethernet"

  config.vm.hostname = "control.aws"

  # Synced Folders
  config.vm.synced_folder "/", "/vagrant/webroot/", :owner => "www-data"
end

1 个答案:

答案 0 :(得分:1)

分配config.vm.synced_folder时您正在执行的操作是将整个主机文件系统挂载到/vagrant/webroot目录下。你确定你打算做什么吗?尝试安装任何其他目录,您将看到webroot目录未创建。

例如,这将共享vagrant项目目录,它可以正常工作。

config.vm.synced_folder ".", "/vagrant/webroot/", :owner => "www-data"