Apache Default page instead of Laravel Application
I am sure this is the kind of question that is annoying, but I am brand new to ubuntu and I am totally lost, hence I don't know what to google for.
I have to deploy a laravel application on a Ubuntu 21.04 VM, I connect via SSH & a VPN to the VM (its from my university).
I installed the laravel application successfully and when I run php artisan serve
it works, I get the message PHP 7.4.16 Development Server (http://127.0.0.1:8000) started
However, when I then enter the IP of the server in my browser I get the default apache webpage, when I enter the IP with port 8000 I get that the server is not responding.
I tried googling but I just don't know what to google for, any help appreciated!
When you are running php artisan serve
, that command is starting its own webserver. And based on the output you posted, it is listening only on 127.0.0.1:8000
.
So accessing it outside of that machine is not allowed. Based on this question on Stack Overflow, you can override the default host with the --host
parameter.
In your case you can run it like so:
php artisan serve --host=<IP_ADDRESS_OF_THE_VM>
or you can make it open to the world with
php artisan serve --host=0.0.0.0