与Vagrant laravel宅基地的代理问题

时间:2015-07-02 00:26:25

标签: windows laravel vagrant

我正试图在Windows PC上使用Laravel家园,并在代理后面使用Vagrant。我使用'vagrant-proxyconf'并使用代理详细信息更新了我的vagrantfile

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http = "http://$my_account:$my_password@yproxyserver.com.au:8080"
    config.proxy.https = "http://$my_account:$my_password@myproxyserver.com.au:8080"
    config.proxy.no_proxy = "localhost,127.0.0.1"
  end
end

然而,每当我试图'流浪'时,我都会收到错误:

  

无法下载“https://getcomposer.org/version”文件:   无法打开流:无法通过代理连接到HTTPS服务器

我也尝试过制作代理https,没有任何改进。

config.proxy.https = "https://$my_account:$my_password@myproxyserver.com.au:8080"
        config.proxy.no_proxy = "localhost,127.0.0.1"

谁能说出我做错了什么?

有什么我可以尝试缩小问题的范围吗?例如是否可以使用Vagrantfile

测试与代理的连接,测试代理用户身份验证

仅供参考:我在Windows 7 64位上使用GIT Bash命令行

2 个答案:

答案 0 :(得分:0)

通过Windows GUI设置此变量使我可以通过我们的代理连接(右键单击计算机>属性>高级系统配置>高级选项选项卡>环境变量)。

private static void setup() throws IOException {

    String username = System.getProperty("user.name");
    System.out.println("username: "+username);
    File file = new File("C:\\Users\\" + username + "\\Documents\\", "data.txt");
    if(!file.exists()) {
        System.out.println("creating file");
        if(file.createNewFile()) {
        System.out.println("Succesfully created file");
        } else{
        System.out.println("Failed to create file");
        }
    }
    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    out.write("Bacon");
    out.close();

}

我花了一整天的时间。对我来说,使用set命令通过CMD设置它,通过Git Bash导出也没有在Vagrantfile中写入它是不行的。

答案 1 :(得分:0)

我知道这是一篇过时的文章,但是我还是在两天前遇到了。

设置代理对我不起作用,因为在运行composer self-update命令之前,宅基地中没有设置代理的内容。因此它总是在以下时间失败:

homestead: Running: script: Update Composer

所以我不得不进入scripts / homestead.rb并删除

composer self-update --no-progress

从“正在更新作曲家”部分的文件中(查找它在何处产生回声)

那时一切对我来说都很好。只需正常使用Vagrant文​​件中的vagrant-proxyconf即可将代理设置放入VM,然后根据需要在完成所有设置后进行作曲家自更新。

希望可以帮助某人。我迷失了两天,不知道与代理无关的proxyconf出了什么问题