I have installed homestead following the steps described in the Laravel site. The installation is completed successfully.
I have configured the Homestead.yaml file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/Code/Homestead/Projects/RestaurantManager
to: /home/vagrant/RestaurantManager
sites:
- map: laravel.app
to: /home/vagrant/RestaurantManager/public
databases:
- homestead
variables:
- key: 'APP_ENV'
value: 'local'
- key: 'APP_DEBUG'
value: 'true'
Edit the hosts file:
127.0.0.1 laravel.app
192.168.10.10 laravel.app
I can run vagrant up and ssh into the virtual machine.
The problem is that the folder mapping does not work. The mapping always uses the same path (D:/Code/Homestead), despite me giving a different one. You can see it here:
So when I try to access the app locally I get "page not available".
The golden rule when you change something in the configuration is to reload the vagrant machine with the provision option, so try running :
vagrant reload --provision
The Homestead.yaml
file should have:
folders:
- map: D:/Code/Homestead/Projects # Note 1
to: /home/vagrant/Code # Note 2
sites:
- map: laravel.app
to: /home/vagrant/Code/RestaurantManager/public
Your hosts
file also needs to be updated to remove the reference to 127.0.0.1
(which is your localhost):
192.168.10.10 laravel.app
I have a similar problem due to the vagrant-hostsupdater. Just uninstall the plugin using
vagrant plugin uninstall vagrant-hostsupdater
and then provision the machine again
vagrant reload --provision
First of all, you need to know that Vagrant automatically configures the current directory of the Vagrantfile
from the host machine as a shared folder to the /vagrant
directory inside the VM.
To disable this default behaviour, add this line in your Vagrantfile
:
config.vm.synced_folder ".", "/vagrant", disabled: true
Secondly, you can write the windows file path by escaping the \
characters like so:
folders:
- map: D:\\Code\\Homestead\\Projects\\RestaurantManager
to: /home/vagrant/RestaurantManager
⚠Important: After you've done this, run:
vagrant reload --provision
Alternatively, you can delete the whole folders
section in your Homestead.yaml
and specify the shared folders mapping directly in Vagrantfile
like so:
config.vm.synced_folder ".", "/home/vagrant/RestaurantManager"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With