简体   繁体   中英

Vagrant /etc/hosts

I've been changing my /etc/hosts file to redirect live urls to my local vagrant box, which worked fine until recently.

I have something like this in my host file

example.be        10.11.10.12

I need to do this because I'm using a third party javascript SDK which is linked to the live domain.

I think this is the most important stuff in the config file:

Vagrant.configure(2) do |config|
  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "bento/debian-7.8"

  config.vm.network "forwarded_port", guest: 80, host: 3001
  config.vm.network "private_network", ip: "10.11.10.12"

  config.ssh.forward_agent = true

  config.vm.synced_folder ".", "/vagrant", type: "nfs" # NFS because VirtualBox shared VM is too slow

  config.vm.provider "virtualbox" do |vb|
    # This all might be a bit excessive, but it'll run ;)
    vb.memory = 2048
    vb.cpus = 4

    # The internet says these changes improve VM performance
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
    vb.customize ["modifyvm", :id, "--ioapic", "on"]
  end
end

I've found similar questions, but none exactly answer my question. The thing is, it worked before and now it doesn't, that the hardest part for me...

FYI: I'm using OS X Yosemite 10.10.5

Okay, I feel stupid now, it seems I just needed to turn things around in my hosts file...

So I should have:

10.11.10.12        example.be

Strange it worked before, though.

Anyway, back to work. Move along, nothing to see here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM