【发布时间】: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