使用 homestead 配置 laravel 开发环境,vagrant up 命令运行正常,但是设置映射文件夹的时候不是我在配置文件里面设置的位置,求大神帮忙。
下面是两个代码,问题就是我设置的文件夹,和配置出来的文件夹对不上。
Homestead.yaml 文件配置
2 ip: "192.168.10.10"
3 memory: 2048
4 cpus: 1
5 provider: virtualbox
6
7 authorize: ~/.ssh/id_rsa.pub
8
9 keys:
10 - ~/.ssh/id_rsa
11
12 folders:
13 - map: ~/Documents/develop
14 to: /home
15
16 sites:
17 - map: goldenquant.app
18 to: /home/goldenquant/public
19 - map: blog.app
20 to: /home/blog/public
21
22 databases:
23 - homestead
terminal 输入 vagrant up 命令返回信息
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: Homestead_default_1468122349760_33905
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /Users/Xing/Documents/Homestead
/vagrant => /Users/Xing/Documents/Homestead
这个是Homestead仓库的映射
首次配置完Homestead.yaml 时,需要运行vagrant provision去运行folder和site的映射
然后再运行vagrant up试试
用这两个东西干嘛?我直接在VMware的Linux虚拟机里面跑Laravel,一切正常就是慢了点。
不知道楼主问题解决没有,我跟你遇到大概相同的问题,我感觉我的配置文件根本没有读取到,在Vagrantfile文件中设置了,能挂载,但是不能访问到挂载的站点
我在配置
homestead
环境时碰到了与你一样的问题,折腾了很久以后解决了。回来向你提供我的方法。
看了你的描述,可以看到在
vagrant up
后,vagrant没有去读你的homestead.yaml文件。这一点可以从下面看出来
他只是默认挂载了
homestead
的目录,而不是你指定的开发文件夹你可以使用
vagrant box list
查看box
的状况如果是类似于
版本号为0这样的,那么你肯定是与我的问题一模一样了。
因此,
你可以去看我在另一篇中的答案