【问题标题】:Laravel Homestead: requested URL could not be retrieved (working behind proxy)Laravel Homestead:无法检索请求的 URL(在代理后面工作)
【发布时间】:2017-12-06 08:16:47
【问题描述】:

我正在使用公司代理后面的 Windows 10 笔记本。最后,我成功设置了 VirtualBox、Vagrant 和 Homestead。

很遗憾,我无法在浏览器中访问我的网站。它说:无法检索请求的 URL,无法从主机名“test.app”确定 IP 地址。

我已经安装了 vagrant 插件vagrant-proxyconf 并将其设置在我的 Homestead 文件夹中的 Vagrantfile 中。我在我的 Vagrantfile 中添加了以下几行:

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.require_version '>= 1.9.0'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    if Vagrant.has_plugin?("vagrant-proxyconf")
        config.proxy.http     = "http://proxy.my.proxy.com:3128"
        config.proxy.https    = "http://proxy.my.proxy.com:3128"
        config.proxy.no_proxy = "localhost,127.0.0.1,192.168.10.10"
    end
    # ... default configuration
end

这是我的 Homestead.yaml:

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: C:/Users/wn00111510/Projekte/ContentAnalyzer
      to: /home/vagrant/contentanalyzer
    - map: C:/Users/wn00111510/Projekte/Test
      to: /home/vagrant/test

sites:
    - map: test.app
      to: /home/vagrant/test

databases:
    - homestead

我的主机文件只有一个条目:

192.168.10.10    test.app

机器正在运行,我可以通过 vagrant ssh 登录到我的虚拟机。 vagrant reload --provision 不会改变任何东西。

在启动过程中出现关于连接重置的警告:

...
Booting VM...
Waiting for machine to boot. THis may take a few minutes...
SSH address: 127.0.0.1:2222
SSH username: vagrant
SSH auth method: private key
Warning: Connection reset. Retrying...
Warning: Remote Connection disconnect. Retrying...
Warning: Connection reset. Retrying...
Warning: Remote Connection disconnect. Retrying...
Warning: Connection reset. Retrying...
Machine booted and ready!
...

有什么想法吗?

【问题讨论】:

    标签: vagrant virtual-machine virtualbox homestead


    【解决方案1】:

    我不是代理方面的专家,但由于这是您的机器本地的,您应该能够绕过任何代理。您是否尝试过不使用代理插件?

    这里的错误:

    Warning: Connection reset. Retrying...
    Warning: Remote Connection disconnect. Retrying...
    

    只要机器在合理的时间内连接通常没什么大不了的。

    由于您仅将 1 个站点映射到计算机,因此您还应该能够使用 http://localhost:8000(或在 vagrant up 过程中 Vagrant 映射到 80 的不同端口)完全绕过 DNS。

    【讨论】:

      猜你喜欢
      • 2013-12-24
      • 1970-01-01
      • 2018-12-20
      • 2017-11-16
      • 2023-03-12
      • 1970-01-01
      • 2018-11-28
      • 2016-03-08
      • 2021-05-02
      相关资源
      最近更新 更多