使用枪口在流浪汉上犯下错误7 [英] Curl error 7 on vagrant using guzzle

查看:79
本文介绍了使用枪口在流浪汉上犯下错误7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了卷曲错误7:无法连接到site1.local端口8000:连接被拒绝,当我从另一个本地站点(site2.local )。两个站点都在同一个Vagrant框上运行。

I've get an Curl error 7: Failed to connect to site1.local port 8000: Connection refused, when i call it from another local site (site2.local). Both sites run on the same Vagrant box.

当我将URL替换为外部网站(例如google.com)的URL时,连接没有问题。

When i replace the url to an url of an external site (eg. google.com), there is no problem in connecting.

为什么流浪汉拒绝自己打来的电话?
我搜索了问题,但找不到任何解决方案。

Why does vagrant refuse a call from his own? I searched the problem, but couldn't find any solution to this.

是否可以使用curl调用同一服务器上的另一个站点?

Is there a way to call to another site on the same server using curl?

编辑:

Vagrantfile:

Vagrantfile:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  Homestead.configure(config, YAML::load(File.read(path + '/Homestead.yaml')))
end

Homestead.yaml

Homestead.yaml

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: C:/Users/Robert/.ssh/id_rsa.pub

keys:
    - C:/Users/Robert/.ssh/id_rsa

folders:
    - map: A:/homestead/projects
      to: /home/vagrant/projects

sites:
    - map: site1.local
      to: /home/vagrant/projects/work/work-site-1/public
   - map: site2.local
      to: /home/vagrant/projects/work/work-site-2/public


推荐答案

仅使用 8000 8443 端口当您想从本地机器(主机)访问无业游民的网站时。如果要访问无业游民(访客计算机)中的站点,则应使用标准的HTTP端口( 80 ),因为不需要任何类型的映射。

The 8000 and 8443 ports are only used when you want to access a site in vagrant from your local box (host machine). If you want to access a site within vagrant (guest machine) you should use the standard HTTP port (80), since no kind of mapping is needed.

我敢打赌这就是问题所在。

I bet that's the issue.

这篇关于使用枪口在流浪汉上犯下错误7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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