Homestead注意问题

Homestead.yaml 目录

查看Vagrantfile

1
2
//代表在当前目录下
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
1
2
//代表在用户目录下
confDir = $confDir ||= File.expand_path(File.join(Dir.home, ".homestead"))

Homestead 名称

修改scripts/homestead.rb,注意4处地方

1
2
3
4
5
6
7
8
9
10
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"

网络配置

私有网络

1
2
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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

1
2
# 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

1
2
3
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可以访问

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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

1
2
3
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可以访问

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :