laravel php artisan serve --host 0.0.0.0 无法从同一网络上的移动设备访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51988699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php artisan serve --host 0.0.0.0 can't be accessed from mobile device on same network
提问by RichardManson
I have attempted to share my laravel project over a shared network, using;
我试图通过共享网络共享我的 Laravel 项目,使用;
php artisan serve --host 192.168.X.XXX --port 8000
php artisan serve --host 192.168.X.XXX --port 8000
This works and produces no errors but I still can't access my application on other machines connected to the same wifi network, using my Mac's ip address to connect.
这有效并且不会产生任何错误,但我仍然无法在连接到同一 wifi 网络的其他机器上访问我的应用程序,使用我的 Mac 的 IP 地址进行连接。
I have tried different ports and changed the ip address of my Mac to try and fix it but nothing has worked so far.
我尝试了不同的端口并更改了我的 Mac 的 IP 地址以尝试修复它,但到目前为止没有任何效果。
Any idea what could be causing this issue? Any suggestions would be greatly appreciated, thanks!
知道是什么导致了这个问题吗?任何建议将不胜感激,谢谢!
回答by AnyKey
Because 0.0.0.0 is another name of 127.0.0.1 and "localhost". 0.0.0.0 means any local (internal) interface. You must use IP of your local network (i.e 192.168.x.x)
因为 0.0.0.0 是 127.0.0.1 和“localhost”的另一个名称。0.0.0.0 表示任何本地(内部)接口。您必须使用本地网络的 IP(即 192.168.xx)