Search code examples
phplaravelserverportserve

How to run a Laravel serve that can be possible run also on LAN not only in my pc?


I tried using this command but did not work.

php artisan serve --host 192.168.2.20 --port 8000

error:

Laravel development server started: http://192.168.2.20:8000
[Sun Jan 24 20:54:26 2021] Failed to listen on 192.168.2.20:8000 (reason: The requested address is not valid in its context.
)

Solution

  • Answer

    Run this command:

    php artisan serve --host 0.0.0.0
    

    get your IPv4 address from ipconfig

    for example: 192.168.1.10

    And address 192.168.1.10:8000 is valid using in LAN