I'm having problems mapping a folder in my vagrant machine to a local laravel website. Instead of mapping laravel.test
to code/laravel/public
in the vagrant machine, it maps to localhost.
This is the Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa_homestead.pub
keys:
- ~/.ssh/id_rsa_homestead
folders:
- map: ~/projects
to: /home/vagrant/code
sites:
- map: laravel.test
to: /home/vagrant/code/laravel/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
Here is etc/hosts
:
127.0.0.1 localhost
# Local websites
127.0.0.1 laravel.test
# other stuff...
I know laravel.test
is being mapped to /var/www/html/index.php
because when I access laravel.test
it prints phpinfo()
, which is exactly what it prints in var/www/html/index.php
. I guess what is happening is the folowng: laravel.test
is mapped to localhost
, which is mapped to /var/ww/html/index.php
because I have Apache running on my physical machine. What I need is to map laravel.test
to my vagrant machine.
Any help is appreciated.
Note: Vagrant version is 2.2.9 and ubuntu version is 18.04
UPDATE
When I access laravel.test:8000
it does work and I can access my laravel application. However, I'd like to know if there is a way to access the site without specifying the port 8000
.
Using the ip
address from the yaml
in the hosts
file instead of 127.0.0.1
would work. Same ip address may be used outside of the box while connecting to services such as mysql.
127.0.0.1 localhost
# Local websites
192.168.10.10 laravel.test
# other stuff...