dqvs45976 2016-10-19 08:33
浏览 31
已采纳

运行具有不同站点版本的两个流浪盒

I'm using 2 vagrant boxes to run two different php versions (PHP5.4 and PHP7) on a websites codebase.

Both of these vagrant boxes sync the same folder.

How can I set these up to have the following domains:

PHP7:
php7.domain.com
local.domain.com

PHP5:
php5.domain.com
local.domain.dev

I also want the PHP5 box to run from the PHP7 box's database. What settings should I change here?

  • 写回答

1条回答 默认 最新

  • dongsilu2237 2016-10-19 19:48
    关注

    You can use a plugin to manage hostnames: vagrant-hostmanager

    here is how you can use it for both machines:

    Vagrant.configure(2) do |config|
    
      config.hostmanager.enabled = true
      config.hostmanager.manage_host = true
      config.hostmanager.manage_guest = true
    
      config.vm.define "php7" do |php7_config|
        php7_config.vm.box = "..."
        php7_config.vm.hostname = "php5"
        php7_config.vm.network :private_network, ip: "192.168.10.10"
        php7_config.hostmanager.aliases = [ "php7.domain.com" ]
      end
    
      config.vm.define "php5" do |php5_config|
        php5_config.vm.box = "..."
        php5_config.vm.hostname = "php5"
        php5_config.vm.network :private_network, ip: "192.168.10.20"
        php5_config.hostmanager.aliases = [ "php5.domain.com" ]
      end
    
    end  
    

    After you run it it will place the records php7.domain.com, php5.domain.com in /etc/hosts

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'