Have a Laravel App on a Vagrant Box, Ubuntu 20.04 and Nginx, installed with Homestead.
I use browsersync to watch for file changes.
Suddenly I get a 502 Bad Gateway error at the URL localhost:3000, when npm run watch
is running.
However if i do php artisan serve
, the provided local url 127.0.0.1:8000 and the myproject.test domain are working correct if i open one of the url's in a browser.
But browsersync don't update this url's, it syncs only over localhost:3000.
vagrant destroy
& vagrant up
What can i do, to find out why i'm getting this error at localhost:3000 and at 127.0.0.1:8000 not?
You can use port forwarding to force data from VM ip to localhost but it's easier to just use virtual machine's ip.
(Linux)
vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null
(OS X)
vagrant ssh -c "hostname -I | cut -d' ' -f2" 2>/dev/null | pbcopy
The command for Linux also works for windows. I have no way to test, sorry. source:
https://coderwall.com/p/etzdmq/get-vagrant-box-guest-ip-from-host