windows 10 `hosts` file can not resole a domain names that are in virtual machine

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

windows 10 `hosts` file can not resole a domain names that are in virtual machine

luo kan
I am using `Vagrant 2.0.0` on Windows 10 x64, VirtualBox is `5.1.26`.

I have installed centos 7 vagrant box , it is running correctly.  

`Vagrantfile` is like this:


```
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure("2") do |config|
      
      config.vm.box = "dev"
      config.vm.hostname = "vagrant-dev"
      config.vm.network "forwarded_port", guest: 80, host: 8080
      config.vm.network "private_network", ip: "192.168.33.3"
      config.vm.synced_folder "d:/vagrant_env/www/", "/var/www"
      
    end
```
I installed nginx in centos 7 vagrant box, and I can access nginx welcome page with ip `192.168.33.3`.   

I want to access it with domain name,so I configure `C:\Windows\System32\drivers\etc\hosts`
 file in windows:

```
192.168.33.3   test-example.vagrant   //add this line into `hosts` file of windows
```

and configure `/etc/nginx/conf.d/default.conf` file in centos 7:



```
    server {
        listen       80;
        server_name  test-example.vagrant;
        //...
    }
```

I try accessing `test-example.vagrant` on windows , but it does not work.   
   
what should I do?



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/fbf029c7-d01a-4e7f-b027-c6dbf6d6ac53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.