无法从laravel访问localhost:8080 [英] Cannot access localhost:8080 from laravel

查看:342
本文介绍了无法从laravel访问localhost:8080的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在宅基地盒上运行的PHP应用程序.该应用程序调用了另一个在我的本地主机上运行在glassfish上的应用程序:8080.

I have a PHP application running on homestead box. This application makes calls to another app that is running on glassfish on my localhost:8080.

当PHP应用程序将请求发送到localhost:8080时,出现以下错误:

When PHP application sends the request to localhost:8080, I am getting following error:

ConnectException in RequestException.php line 49:
cURL error 7: Failed to connect to localhost port 8080: Connection refused

仍然可以从Web浏览器拨打localhost:8080.有人有什么建议吗?

Still I can make calls to localhost:8080 from web browser.Anyone has any suggestion?

推荐答案

所以这是解决问题的方法. Vagrant是在我的本地主机上作为主机运行的来宾计算机.要从来宾访问主机,您需要使用VB的网关.

So here is how I could solve the problem. Vagrant is the guest machine running on my localhost as host machine. To access host from guest, you need to use gateway from VB.

我找到了此答案这帮助我在localhost上访问我的应用程序.

I found this answer which helped me to access my application on localhost.

这篇关于无法从laravel访问localhost:8080的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆