Report this

What is the reason for this report?

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

Posted on December 20, 2021

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.