Homestead注意问题
Homestead.yaml 目录
查看Vagrantfile
//代表在当前目录下
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
//代表在用户目录下
confDir = $confDir ||= File.expand_path(File.join(Dir.home, ".homestead"))
Homestead 名称
修改scripts/homestead.rb,注意4处地方
config.vm.define settings["name"] ||= "homestead-7"
...
config.vm.provider "virtualbox" do |vb|
vb.name = settings["name"] ||= "homestead-7"
...
config.vm.provider vmware do |v|
v.vmx["displayName"] = settings["name"] ||= "homestead-7"
...
config.vm.provider "parallels" do |v|
v.name = settings["name"] ||= "homestead-7"
网络配置
私有网络
192.168.10.10 yz.app
192.168.10.10 homestead.app
SSH连接:
- SSH address: 127.0.0.1:2222 或 192.168.10.10:22
- SSH username: vagrant
- SSH password: vagrant
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/Laravel/www
to: /home/vagrant/www
sites:
- map: homestead.app
to: /home/vagrant/www/index
- map: yz.app
to: /home/vagrant/www/yezhou/public
databases:
- homestead
公共网络
通过修改homestead.rb
scripts/homestead.rb
# config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"
config.vm.network :public_network, ip: settings["ip"] ||= "192.168.10.10"
Homestead.yaml
192.168.10.10 yz.app
192.168.10.10 homestead.app
192.168.1.222 ye.app
注意:宿主机通过yz.app不能访问,通过ye.app不能访问;局域网内其他机器设置hosts通过ye.app可以访问
ip: "192.168.1.222"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/Laravel/www
to: /home/vagrant/www
sites:
- map: homestead.app
to: /home/vagrant/www/index
- map: yz.app
to: /home/vagrant/www/yezhou/public
databases:
- homestead
SSH连接:
- SSH address: 127.0.0.1:2222 或 192.168.1.222:22
- SSH username: vagrant
- SSH password: vagrant
直接修改Homestead.yaml
192.168.10.10 yz.app
192.168.10.10 homestead.app
192.168.1.222 ye.app
注意:宿主机通过yz.app可以访问,通过ye.app不能访问;局域网内其他机器设置hosts通过ye.app可以访问
networks:
- type: "public_network"
ip: "192.168.1.222"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:/Laravel/www
to: /home/vagrant/www
sites:
- map: homestead.app
to: /home/vagrant/www/index
- map: yz.app
to: /home/vagrant/www/yezhou/public
- map: ye.app
to: /home/vagrant/www/yezhou/public
databases:
- homestead
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/02/25/homestead-precautions/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Homestead注意问题
Homestead.yaml 目录
查看Vagrantfile
//代表在当前目录下
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
//代表在用户目录下
confDir =……
文章目录
关闭
共有 0 条评论