vagrant没有看到别名

时间:2016-02-27 12:35:31

标签: apache vagrant vagrantfile

我的流浪汉有问题。我用该项目创建了客户ubuntu 14.04。这是我的流浪文件

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    config.vm.box = "example"

    config.vm.provider :virtualbox do |v|
        v.customize ["modifyvm", :id, "--memory", "4056"]
        v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
        v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
        v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home/user/sites/projects-folder", "1"]
        # v.customize ["modifyhd", :id, "--resize", "15360"]
    end

    config.vm.provision :shell, :inline => "sudo apt-get update"

    config.vm.synced_folder "/home/user/sites/projects-folder", "/var/www/projects-folder", create: true, :nfs => true
    config.nfs.map_uid = Process.uid
    config.nfs.map_gid = Process.gid

    config.vm.network :private_network, ip: "33.33.33.11"    
    config.vm.network :forwarded_port, guest: 80, host: 8081

    config.hostsupdater.aliases = ["www.example.local, api.example.local, business.example.local"]

end

这是来自/ etc / apache2 / sites-enabled

的配置
<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName www.example.local
    ServerAlias www.example.local

    DocumentRoot /var/www/projects-folder/www.example/dist

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

当我从主机上访问ip 33.33.33.11时,我看到了apache页面(所以它的工作原理)。

但www.example.local - 不

1 个答案:

答案 0 :(得分:0)

您是否在vagrant中安装了hostupdater插件?您可以通过执行

来检查已安装的插件
$ vagrant plugin list

如果没有安装hostupdater,您可以使用

进行安装
$ vagrant plugin install vagrant-hostsupdater