Cannot connect to Laravel server in Virtual Box appliance

I am trying to implement my first Rest API using Laravel.

I am running Debian on a Virtual Box machine on a Windows host. The network card of the VM is configured to “Host-only adapter”.

I am able to reach the phpmyadmin instance on the machine using http://ip-of-the-vm/phpmyadmin. But when I try to reach the Laravel appliance on http://ip-of-the-vm:8000 it does not work. I think the port could be the problem.

Does anybody have a suggestion for how to solve this?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

The problem was that laravel was only reachable over localhost. You have to start the server using
php artisan serve --host 0.0.0.0 where 0.0.0.0 should be replaced with the ip of the server.
You can optionally define a port if you want by using
php artisan serve --host 0.0.0.0 --port 80 for example.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x