解放双手 hosts 自动化 (Vagrant-hostsupdater)
通常情况下我们创建一个新项目时还需要在本机 hosts 文件新增 host,但是如果按下面的方法你可以解放双手(偷个懒)
-
Homestead 目录下安装(安装插件)
$ vagrant plugin install vagrant-hostsupdater
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes... Installed the plugin 'vagrant-hostsupdater (1.1.1.160)'!
-
接着:(更改了
Homestead.yaml
文件 site 后执行)$ vagrant reload --provision
==> homestead-7: [vagrant-hostsupdater] 192.168.10.10 ddang-lumen.io # VAGRANT: b2102deda09b4ebc5eefa5a77ad71960 (homestead-7) / 53d249c4-1c8b-44fc-8d54-f9630c927abf . . . ==> homestead-7: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> homestead-7: flag to force provisioning. Provisioners marked to run always will still run.
-
一切正常的话 此时
hosts
文件应该是:192.168.10.10 laravel-2.watts.com # VAGRANT: d399a2b6073dccadc0d7de43f126182e (homestead-7) / f4e325ac-1865-4d28-a5cd-198236f6926d 192.168.10.10 laravel-5.watts.com # VAGRANT: d399a2b6073dccadc0d7de43f126182e (homestead-7) / f4e325ac-1865-4d28-a5cd-198236f6926d 192.168.10.10 laravel-6.watts.com # VAGRANT: d399a2b6073dccadc0d7de43f126182e (homestead-7) / f4e325ac-1865-4d28-a5cd-198236f6926d 192.168.10.10 lumen-5.watts.com # VAGRANT: d399a2b6073dccadc0d7de43f126182e (homestead-7) / f4e325ac-1865-4d28-a5cd-198236f6926d 192.168.10.10 phpmyadmin.watts.com # VAGRANT: d399a2b6073dccadc0d7de43f126182e (homestead-7) / f4e325ac-1865-4d28-a5cd-198236f6926d
OK!
本作品采用《CC 协议》,转载必须注明作者和本文链接