Curl error 7 on vagrant using guzzle

让人想犯罪 __ 提交于 2019-12-21 23:04:28

问题


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.

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.

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

edit:

Vagrantfile:

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

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

回答1:


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.



来源:https://stackoverflow.com/questions/29417178/curl-error-7-on-vagrant-using-guzzle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!