Configuring Shared Folders
Steps to Configuring Shared Folders in Laravel Homestead:
Run
init.batcommand from the Homestead directory to create the Homestead.yaml configuration file.
init.bat
init.bat command from the Homestead directory.Run
code .command from the Homestead directory to open the repository in VS Code.
C:\vm\Homestead>code .Select Homestead.yaml file to display configuration.

Update the
folders:configuration with the below configuration:
```
folders:
- map: /code
to: /home/vagrant/code
type: "nfs"
```Create a directory/folder mapping to share your Laravel project/code between your host and Homestead guest machine. In this example, I mapped the
C:\codefolder to the/home/vagrant/codefolder in the Homestead virtual machine.

Update the
sites:configuration, by adding your project name.
sites:
- map: acware.test
to: /home/vagrant/code/{projectname}/public
In this example, we named the project mylaravelapp which will be discussed in detail in Creating a Laravel project in Homestead.

Your Homestead.yaml configuration will look like this:
---
ip: "192.168.56.56"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /code
to: /home/vagrant/code
type: "nfs"
sites:
- map: acware.test
to: /home/vagrant/code/mylaravelapp/public
databases:
- acw
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
services:
- enabled:
- "mysql"
# - disabled:
# - "postgresql@11-main"
#ports:
# - send: 33060 # MySQL/MariaDB
# to: 3306
# - send: 4040
# to: 4040
# - send: 54320 # PostgreSQL
# to: 5432
# - send: 8025 # Mailhog
# to: 8025
# - send: 9600
# to: 9600
# - send: 27017
# to: 27017
Save the changes to the
Homestead.yamlfile and exit.You need to install the vagrant-winnfsd plugin for
type:"nfs"configuration by running the following command in your terminal:
vagrant plugin install vagrant-winnfsd
This required restarting the computer after the installation.
That's it! You have successfully configured shared folders in Laravel Homestead on a Windows machine.
In the next topic, we will generate SSH Keys. SSH keys are a pair of cryptographic keys (a public key and a private key) that can be used to authenticate with remote servers or services, without the need for a password.
Last updated