我刚刚在OSX 10.10(Yosemite)的VirtualBox上为Laravel 5设置了Homestead 2.0 vagrant服务器,它的运行速度比MAMP慢很多。
我真的很想使用Homestead,但加载页面的1-3秒延迟变得非常烦人,但是每个加载请求都是在MAMP上即时的。
我在设置中遗漏了什么?
Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/jackbarham/Code
to: /home/vagrant/Code
sites:
- map: tasks.mac
to: /home/vagrant/Code/tasks/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
主机:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 tasks.mac
127.0.0.1 tasks-mamp.mac # MAMP PRO - Do NOT remove this entry!
答案 0 :(得分:2)
我在reddit / r / laravel上问了同样的问题并得到了答案:
在以下位置找到homestead.rb文件:/Users/username/.composer/vendor/laravel/homestead/scripts
关闭虚拟机(家园停止)
打开homestead.rb文件,在第49行,"#注册所有已配置的共享文件夹"改变:
从:
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil
end
为:
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, :nfs => true
end
config.vm.network "private_network", type: "dhcp"
答案 1 :(得分:0)
在我的情况下使用Windows作为HOST是相同的,这是因为VirtualBox使用vboxsf作为文件系统将文件从主机挂载到guest,我不知道为什么但是它太慢了。
在GUEST(Ubuntu 16.04)上,我使用CIFS将工作文件夹安装为网络文件夹,运行速度更快。
在客人方面,我使用:https://wiki.ubuntu.com/MountWindowsSharesPermanently
在主机端(mac)我认为您应该按照以下说明操作:https://support.apple.com/kb/PH18707?locale=en_US