AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 564241
Accepted
ljs.dev
ljs.dev
Asked: 2013-12-31 14:14:25 +0800 CST2013-12-31 14:14:25 +0800 CST 2013-12-31 14:14:25 +0800 CST

具有多个可寻址 domain.locals 的 Vagrant 单框

  • 772

我目前利用 Vagrant 和 Chef 为不同的应用程序配置单独的 linux VM。

这些应用程序可从主机进行域寻址,无需在主机上进行任何其他设置。这是在 linux 客户机上使用 avahi 实现的。主机然后通过访客的主机名访问,例如:

myguest1.local -> VM#1
myguest2.local -> VM#2

我现在要安装另一个应用程序,用于复制生产服务器,应该有 2 个 Apache 虚拟主机可在一个 VM 中寻址,例如:

myguest3.local    
               -> VM#3
myguest4.local    

我也可以使用 Vagrant/Chef 完全实现这一点,而不需要对主机进行任何修改吗?

domain-name-system
  • 3 3 个回答
  • 1642 Views

3 个回答

  • Voted
  1. nha
    2014-11-24T04:41:11+08:002014-11-24T04:41:11+08:00

    有一个 Vagrant 插件: vagrant-hostsupdater

    从 github 页面提取:

    This plugin adds an entry to your /etc/hosts file on the host system.
    On up, resume and reload commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.
    
    On halt and destroy, those entries will be removed again.
    

    还有vagrant-hostmanager,它支持 Windows 机器。我没有使用它,所以欢迎任何反馈。

    从它的 github 页面中提取:

    vagrant-hostmanager is a Vagrant 1.1+ plugin that manages the /etc/hosts file on guest machines (and optionally the host). Its goal is to enable resolution of multi-machine environments deployed with a cloud provider where IP addresses are not known in advance.
    

    所以似乎这两个插件都自动将条目添加到/etc/hosts

    • 1
  2. Zeb
    2014-01-02T08:08:38+08:002014-01-02T08:08:38+08:00

    它肯定会起作用,但是您需要在主机的 /etc/hosts 文件中手动设置虚拟主机的条目。这应该是主机上唯一需要的步骤。

    • 0
  3. Best Answer
    Matt
    2014-01-08T05:34:16+08:002014-01-08T05:34:16+08:00

    您可以使用 Avahi.EntryGroup.AddRecord: python example通过 Avahi API 宣布别名。

    SO上提供了使用脚本的详细解决方案

    • 0

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve