Vagrant-Homestead设置多个站点 [英] Vagrant - Homestead Setup Multiple sites

查看:340
本文介绍了Vagrant-Homestead设置多个站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用homestead.yaml映射了文件夹等;

I have mapped the folders etc using the homestead.yaml;

ip: "192.168.10.10"

...

folders:
    - map: /Users/User/Desktop/folder/Homestead/First
      to: /home/vagrant/First

    - map: /Users/User/Desktop/folder/Homestead/Second
      to: /home/vagrant/Second

sites:
    - map: first.dev
      to: /home/vagrant/First/public

    - map: second.dev
      to: /home/vagrant/Second/public

但是,当我设置主机文件时,将我的second.dev设置为192.168.10.10的etc/hosts我发现映射转到了first.dev,而不是我为second.dev设置的映射.

But when i set up the hosts file, etc/hosts with my second.dev to 192.168.10.10 i find that the mapping goes to first.dev, not the mapping that i have set up for second.dev.

如何使映射返回正确的站点?

How can i go about making the mapping return the correct site?

我正在使用Mac OSX.

I am using Mac OS X.

推荐答案

使用流浪者命令

在终端中运行命令vagrant provision或在Homestead文件所在的文件夹中运行命令提示符.

Run the command vagrant provision within terminal or your command prompt within the folder where homestead files are located.

另一个等效命令是vagrant up --provision,这将配置和运行无业游民的机器.

Another equivalent command is vagrant up --provision this will provision the vagrant machine as well as run it.

使用Global Homestead

您可以使用命令homestead provision重新配置无业游民的机器,而不管您从终端在何处调用它.

You can use the command homestead provision to re-provision the vagrant machine, regardless of the place you call it from within the terminal.

或者,您可以使用serve命令将信息添加到您的Homestead.yaml文件中.像这样;

Alternatively, you can use the serve command to add the information to your Homestead.yaml file for you. Like so;

serve domain.app /home/vagrant/Code/path/to/public/directory

但是将其添加到您的主机文件中,以便您可以通过浏览器中的domain.app访问您的应用.

But add this to your hosts file so you can access the your app via domain.app in your browser.

这篇关于Vagrant-Homestead设置多个站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆