简体   繁体   中英

Installing multiple Laravel homestead machines

I was wondering how I would be able to run multiple versions of homestead without having VirtualBox crash.

I am currently running a default installation of the laravel homestead, but I need to install another custom one, which is customised to work with several proxies.

Just to be clear: I know how to run multiple sites. That is not the issue. I just want to run a second, custom version of the Laravel Homestead Vagrant box, while still having the possibility to run my normal one.

Details: I'm running Homestead v2.1.7 on Mac

Thanks in advance!

I know it's an old question, but the problem is still accurate.

There are some circumstances when you have to run two instances of homestead at the same time. For example when you have app that is works with apache, and one that is freaking out when you enable apache on a server. When you enable it on one website in Vagrant.yaml it will redirect every page that is not using apache to the site that is using it, see example:

- map: presta.shop
  to: /home/vagrant/htdocs/presta-shop
  type: apache
  
- map: my.app
  to: /home/vagrant/htdocs/my-app

In this situation when you will call my.app homestead will redirect you to presta.shop - because this site is using apache (PrestaShop needs to run under apache). See this link: Github NGINX and Apache conflict #555

My my.app will crash with apache enabled, or I just don't want to enable it on this app, or I just need one extra server just for testing or something. You have to follow those steps from install homestead . After the installation of first server you need to:

  • run VirtualBox (or other machine you are using)
  • find and rename added homestead box (homestead), to what ever you wish ie: apache_homestead
  • go to homestead dir (cloned from git)
  • find file: Homestead.yaml
  • in Homestead.yaml add new line after provider with name (this is the name of your renamed box apache_homestead in this case), and ip for let say: 192.168.10.11

in this file you can configure many settings, including name :

ip: "192.168.10.11"
memory: 3072
cpus: 1
provider: virtualbox
name: apache_homestead

After that You may change name of a dir where homestead clone is (default name is homestead). If you rename it to homestead_apache and run vagrant up from this directory you will have completely independent server.

To run "normal" server just follow the instructions from install homestead again and run as many servers as You wish :) Run any just go to it homestead directory and run vagrant up . Remember the limitation of your host machine!

IMPORTANT NOTE! You can have all files for all servers in one dir, but every server has it's own database!! . So before you will move application to another server export and import it's database!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM