laravel homestead真是个好东西啊,折腾了很长时间,终于ok啦。
安装成功之后,在~目录下有个homstead,进入执行vagrant up
clzdeMBP:Homestead clz$ vagrant up Bringing machine ‘default‘ up with ‘virtualbox‘ provider... ==> default: Checking if box ‘laravel/homestead‘ is up to date... ==> default: A newer version of the box ‘laravel/homestead‘ is available! You currently ==> default: have version ‘0.3.0‘. The latest is version ‘0.3.3‘. Run ==> default: `vagrant box update` to update. ==> default: Resuming suspended VM... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Machine booted and ready!
配置文件
clzdeMBP:Homestead clz$ cd ~ clzdeMBP:~ clz$ cd .homestead/ clzdeMBP:.homestead clz$ vim Homestead.yaml
folders: - map: ~/project/vagrant/php7dev to: /home/vagrant/Code sites: - map: php7dev.app to: /home/vagrant/Code/php7dev
第一个folders 就是本地文件夹和虚拟机文件夹的一个映射关系 在本地的文件的改动会同步到虚拟机文件件里
登录到虚拟机 在homstead目录下执行vagrant ssh 可以进入到虚拟机里 在虚拟机里可以对服务 nginx mysql phpfpm 等的操作
在本地的hosts里配置访问的域名。
时间: 2024-12-14 11:34:03