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

10 просмотров
Перейти к первому непрочитанному сообщению

luo kan

не прочитано,
3 окт. 2017 г., 15:16:0203.10.2017
– Vagrant
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?



Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений