使Laravel Homestead可通过Internet访问 [英] Make Laravel Homestead Accessible via the Internet
问题描述
如何通过互联网访问Laravel Homestead(一个无业游民的虚拟机)?目前,我已将路由器设置为端口转发到主机的本地IP.但是,这导致Laravel网站认为所有传入请求都来自10.0.2.2.
How can I make Laravel Homestead (a Vagrant vm) accessible via the internet? Currently, I have set my router to port-forward to my host machine's local IP. However, that causes the Laravel site to think that all incoming requests are coming from 10.0.2.2.
通过互联网访问该网站的正确方法是什么?我是否需要从路由器DHCP中为VM分配IP?如果是这样,我该怎么办?
What would be the correct way to make the site accessible via the internet? Would I have to get the VM to be assigned an IP from the routers DHCP? If so, how do I do that?
推荐答案
如今,正确的答案是通过ssh在命令行上使用Homestead的 share
别名.
The correct answer these days would be to use Homestead's share
alias on the command line via ssh.
例如 share acme.app
在幕后,它使用 ngrok ,并记录在 Laravel文档.
Behind the scenes, this uses ngrok and is documented in the Laravel documentation.
这篇关于使Laravel Homestead可通过Internet访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!