本地主机在Windows(8.1)版本上建立流动和虚拟机 - 流浪文件规范
问题描述:
使本地主机正常工作时出现问题。本地主机在Windows(8.1)版本上建立流动和虚拟机 - 流浪文件规范
运行git bash的我已经成功地漂泊不定的init “hashicorp/precise32”
无业游民了
也许我把我的本地主机IP在错误的地方:127.0.0.1
确认我的虚拟机正在运行,这是我的无业游民文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise32"
# config.vm.boot_timeout = "300"
# Setting this above never worked for me when i had a config.vm.boot_timeout
config.vm.network :forwarded_port, guest: 80, host: 8082
# config.vm.network :public_network
config.vm.network "private_network", ip: "127.0.0.1"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
config.vm.provider :virtualbox do |vb|
vb.gui = true
# I turned this vb.gui = true on when i was having a problem with config.vm.boot_timeout
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.cpus = 4
end
end
我已经添加了一些额外的选择,但我觉得我的IP或端口都是错误的。任何帮助将不胜感激。谢谢。
编辑************************
主机文件看起来像这样:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handle within DNS itself.
127.0.0.1 localhost
::1 localhost
后我流浪的重装:
$ vagrant reload
==> default: [vagrant-hostsupdater] Removing hosts
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'hashicorp/precise32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 (guest) => 8082 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions 5.1.8 running --- OK.
==> default: Checking for guest additions in VM...
==> default: [vagrant-hostsupdater] Checking for host entries
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Timothy/Documents/Magento
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
这是为什么现在这么混乱,我从来没有这么麻烦建立一个本地开发。环境。
答
你不能使用你的主机的私人网络127.0.0.1
这是你的环回适配器,所以它永远不能到达你的虚拟机。
您应该使用在3个以下范围(见https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces)
- 10.0.0.0 - 10.255.255.255
- 172.16.0.0 - 172.31.255.255
- 192.168.0.0 - 192.168.255.255
vagrant已经创建了一个NAT适配器10.0.2.15
通过ssh进行通信。
我建议采取在192.168.x.x范围内的IP,你将能够与你的虚拟机
正常工作,有没有办法只使用本地主机IP,而不是利用专用网络在所有。它不需要是私人的。我只想运行灯泡环境,就像我在xampp或wamp上一样。 @Frederic Henri – Supplement
我是否将我的主机文件更改为192.168.7.7 localhost ????? – Supplement
所以我现在正在为localhost工作,但它没有找到我的文件夹与我的文件。它的工作http://127.0.0.1:8082/ – Supplement