正确使用 Laravel Homestead
Proper usage of Laravel Homestead
我用 laravel 做过几个项目。我还尝试使用良好实践,例如我们只对所有调用使用模型并使用 artisian 命令。
在我的下一个项目中,我计划使用更多,例如使用 Homestead。
我阅读了更多关于 Laravel Homestead which actually needs Vagrantup 的内容。
但是不知道Homestead的实际需求和安装方法
任何帮助都会对我和未来的读者有所帮助。
我假设您已经安装了 VirtualBox 或 VMWare。从Git下载Homestead后,需要修改Homestead.yaml文件
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: /Users/Documents/workspace/myssh.pub #pub path
keys:
- /Users/Documents/workspace/myssh #ssh key
folders:
- map: /Users/Documents/workspace/dev/myProject #My project directory
to: /home/vagrant/code/myProject #Vagrant project directory, no need to change this /home/vagrant/code/
sites:
- map: yourproject.app #you can change whatever you prefer
to: /home/vagrant/code/myProject/public #no need to change this /home/vagrant/code/
variables:
- key: APP_ENV
value: local
那么,我们就剩下最后一步修改了。打开 /etc/ 下的主机文件。我将使用 VI 来修改它。你可以使用任何你喜欢的东西。
vi /etc/hosts
您需要在此文件中添加新行
192.168.10.10 yourproject.app //same with code line 11
最后,你只需要运行vagrant up。请不要忘记一件事。如果你在没有关闭你的流浪者的情况下关闭你的电脑,那么关闭你的电脑需要很长时间。即使您的 PC 已关闭,当您再次 运行 vagrant up 时,vagrant 也可能会崩溃。在关闭电脑之前,您需要 运行 vagrant halt 以确保安全。
希望对您有所帮助。
我用 laravel 做过几个项目。我还尝试使用良好实践,例如我们只对所有调用使用模型并使用 artisian 命令。
在我的下一个项目中,我计划使用更多,例如使用 Homestead。
我阅读了更多关于 Laravel Homestead which actually needs Vagrantup 的内容。
但是不知道Homestead的实际需求和安装方法
任何帮助都会对我和未来的读者有所帮助。
我假设您已经安装了 VirtualBox 或 VMWare。从Git下载Homestead后,需要修改Homestead.yaml文件
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: /Users/Documents/workspace/myssh.pub #pub path
keys:
- /Users/Documents/workspace/myssh #ssh key
folders:
- map: /Users/Documents/workspace/dev/myProject #My project directory
to: /home/vagrant/code/myProject #Vagrant project directory, no need to change this /home/vagrant/code/
sites:
- map: yourproject.app #you can change whatever you prefer
to: /home/vagrant/code/myProject/public #no need to change this /home/vagrant/code/
variables:
- key: APP_ENV
value: local
那么,我们就剩下最后一步修改了。打开 /etc/ 下的主机文件。我将使用 VI 来修改它。你可以使用任何你喜欢的东西。
vi /etc/hosts
您需要在此文件中添加新行
192.168.10.10 yourproject.app //same with code line 11
最后,你只需要运行vagrant up。请不要忘记一件事。如果你在没有关闭你的流浪者的情况下关闭你的电脑,那么关闭你的电脑需要很长时间。即使您的 PC 已关闭,当您再次 运行 vagrant up 时,vagrant 也可能会崩溃。在关闭电脑之前,您需要 运行 vagrant halt 以确保安全。
希望对您有所帮助。