Question

[Laravel] Can not access site when running Laravel by php artisan

Posted December 20, 2021 162 views
ApacheLAMP StackLaravel

Hi supporter,

I am in deploy the Laravel app on my droplets. I use the php artisan serve to run the server, but I could not access it by IP and port(8000).

Can you give me any ideas?

Regards.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

It sounds like that the port might not be opened via your firewall. If you are using a firewall like ufw you can open the port with the following command:

ufw allow 8000

Also keep in mind that you might have to bind it on 0.0.0.0 rather than localhost:

php artisan serve --host 0.0.0.0

That way the Laravel installation will be accessible externally via your server IP as well.

Let me know how it goes.
Regards,
Bobby