简体   繁体   English

如何在不破坏环境的情况下在宅基地添加新的laravel站点?

[英]how can i add a new laravel site in homestead without destroying environment?

How can i add a new site without running ? 如何在不运行的情况下添加新网站?

homestead destroy
homestead up

Im using Laravel Homestead version 2.0.13 我使用Laravel Homestead版本2.0.13

When i add a new site, i add the following to my homestead.yaml file 当我添加一个新站点时,我将以下内容添加到我的homestead.yaml文件中

folders:
   - map: ~/web/code
     to: /code/websites

sites:
  - map: laravel5.dev
    to: /code/websites/laravel5/public
  - map: anothersite.dev
    to: /code/websites/anotherproject/public

I've added to my hosts file : 我已添加到我的主机文件中:

192.168.10.10 laravel5.dev
192.168.10.10 anothersite.dev

I then proceed to check the status of my machine using: 然后我继续使用以下方法检查我的机器的状态:

vagrant global-status



90be623  default virtualbox running /Users/user/.composer/vendor/laravel/homestead

I run vagrant provision 90be623 to provision my new site but sadly anothersite.dev still points to laravel5.dev 我运行vagrant provision 90be623来配置我的新网站, 但遗憾的是anothersite.dev仍然指向laravel5.dev

The only way i solve this is running homestead destroy and then homestead up. 我解决这个问题的唯一方法是运行宅基地摧毁,然后是宅基地。 But this destroys my database. 但这会破坏我的数据库。

When i run vagrant provision 90be623 i notice alot of times the appearance of: 当我运行流浪汉提供90be623我注意到很多次出现:

==> default: stdin: is not a tty (In red)

Versus when i do homestead destroy and homestead up where everything is in green.. 当我做家园破坏和宅基地时,一切都是绿色的..

Thank you for reading this and helping :) 感谢您阅读本文并提供帮助:)

Ok, so i've found that if i want to add a new site, all i got to do is 好的,所以我发现如果我想添加一个新网站,我所要做的就是

  1. homestead halt 宅基地停了下来
  2. homestead edit 宅基地编辑

Homestead edit will open the homestead.yaml file Here i add the mapping for the site Homestead编辑将打开homestead.yaml文件在这里我添加该站点的映射

  1. Edit the hosts file /etc/hosts and add url i want for example app.dev and save 编辑hosts文件/ etc / hosts并添加我想要的url例如app.dev并保存
  2. homestead up --provision 宅基地 - 提供

It worked like a charm without me having to destroy my machine or databases. 它就像一个魅力,没有我不得不破坏我的机器或数据库。

In Laravel 5.2, there is no need of halting and then starting. 在Laravel 5.2中,不需要停止然后启动。
After adding the new site inside the ".yaml" and "hosts" files, you only need to perform one command in the terminal, from within the Homestead directory: 在“.yaml”和“hosts”文件中添加新站点后,您只需要在Homestead目录中的终端中执行一个命令:

vagrant reload --provision

See here: https://laravel.com/docs/5.2/homestead#adding-additional-sites 请参见: https//laravel.com/docs/5.2/homestead#adding-additional-sites

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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