laravel 如何在我的环境中为新站点刷新宅基地?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27085051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I refresh homestead for a new site in my environment?
提问by Chris Farrugia
I'm running Laravel 4 on my development machine (Mac) with homestead and enjoying it thus far but having trouble when adding a new site. The problem is that I add lines like this for a new site in my ~/.homestead/Homestead.yaml file:
我在我的开发机器(Mac)上运行 Laravel 4 和 homestead 并享受它到目前为止但在添加新站点时遇到问题。问题是我在 ~/.homestead/Homestead.yaml 文件中为新站点添加了这样的行:
folders:
- map: ~/Sites
to: /home/vagrant/Sites
sites:
- map: listingnaples.dev
to: /home/vagrant/Sites/listingnaples.com/public
- map: videocraftersusa.dev
to: /home/vagrant/Sites/videocraftersusa.com/
Then, my /etc/hosts looks like this:
然后,我的 /etc/hosts 看起来像这样:
# MY SITES
192.168.10.10 listingnaples.dev
192.168.10.10 videocraftersusa.dev
192.168.10.10 laneyandchris.dev
If i go in and do a homestead destroy
followed by homestead up
I can access any of those new sites. That deletes my databases though and really sets me back. How do I "refresh" so to speak? If I add myawesomesite.dev to my /etc/hosts, how can I have homestead pick it up?
如果我进入并执行以下操作homestead destroy
,homestead up
我可以访问任何这些新站点。这虽然删除了我的数据库,但确实让我退缩了。可以这么说,我如何“刷新”?如果我将 myawesomesite.dev 添加到我的 /etc/hosts 中,我如何让 homestead 获取它?
I tried homestead --provision
but that isn't a recognized command.
我试过了,homestead --provision
但这不是公认的命令。
For what it's worth, in my ~/.homestead/ directory, I do not have a VagrantFile. Not sure where that's at so I can't run a vagrant provision either.
无论如何,在我的 ~/.homestead/ 目录中,我没有 VagrantFile。不确定它在哪里,所以我也不能运行一个流浪者的规定。
回答by user3556337
I just ssh using homestead ssh
and then add this line
我只是使用 sshhomestead ssh
然后添加这一行
serve domain.app /home/vagrant/Code/path/to/public/directory
where you replace domain.app to your app name, the same you use on your yaml file and your path to your new public site directory, then just homestead up
and you could see it active.
您将 domain.app 替换为您的应用程序名称,与您在 yaml 文件中使用的名称和新公共站点目录的路径相同,然后homestead up
您就可以看到它处于活动状态。
回答by Beaudinn Greve
You can also reload the box and the settings
您还可以重新加载框和设置
vagrant reload --provision
This reload the box and see if there are changes, if that's the case it will make the changes while reloading
这将重新加载框并查看是否有更改,如果是这种情况,它将在重新加载时进行更改
回答by lancedikson
Try run vagrant global-status
. You'll see the list of running boxes at this time, like this:
尝试运行vagrant global-status
。此时您将看到正在运行的框列表,如下所示:
MacBook-Pro-lancedikson:~ lancedikson$ vagrant global-status
id name provider state directory
------------------------------------------------------------------------------------------
9710b02 default virtualbox running /Users/lancedikson/.composer/vendor/laravel/homestead
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
That's all. Now run vagrant provision 9710b02
and it will be provisioned.
就这样。现在运行vagrant provision 9710b02
,它将被配置。
回答by mtpultz
As of Laravel 5 and more importantly Homestead 2.0, just run:
从 Laravel 5 和更重要的 Homestead 2.0 开始,只需运行:
homestead up
Then:
然后:
homestead provision
回答by phaberest
You have to use vagrant provision
anyway from the same directory where Homestead.yaml
is.
vagrant provision
无论如何,您必须从同一目录 where Homestead.yaml
is 使用。
回答by bgies
You can run:
你可以运行:
homestead up --provision
回答by Roderik
In my case I had a Homestead.yaml
in ~/.homestead/
and in ~/Homestead/
.
就我而言,我有一个Homestead.yaml
in~/.homestead/
和 in ~/Homestead/
。
I am not sure if the default location changed or that I changed it manually (maybe because I did not like the hidden dir), but make sure you don't have multiple Homestead.yaml
files. I now symlinked them so I can not confuse myself any further.
我不确定默认位置是更改了还是我手动更改了它(可能是因为我不喜欢隐藏目录),但请确保您没有多个Homestead.yaml
文件。我现在对它们进行符号链接,这样我就不会再混淆自己了。
But normally, homestead provision
or homestead up --provision
(when it was turned off) should do.
但通常,homestead provision
或者homestead up --provision
(当它被关闭时)应该可以。