-
Use Git Bash as your command prompt
-
Official Instructions [LINK]
-
Install Oracle Virtualbox [LINK]
-
Install Vagrant [LINK]
-
Add Homestead into Vagrant:
vagrant box add laravel/homestead
- Create new project with composer
composer create-project --prefer-dist laravel/laravel rhind-laravelTest
- Enter the folder
cd rhind-laravelTest
- Add homestead as a dev dep.
composer require laravel/homestead --dev
- Check homestead installation
vendor/bin/homestead
- Build config file
vendor/bin/homestead make
- Check ssh keys
ls ~/.ssh/
- make new ssh key if empty
ssh-keygen -t rsa -C "[email protected]"
- Check if cmd is run as admin, otherwise Windows won't be able to create the .ssh files with the correct user permissions
net session
- Configure the
Homestead.yaml
file as follows:
ip: 192.168.10.10
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
-
map: 'd:/Sites/rhind-laravelTest'
to: /home/vagrant/code
sites:
-
map: laraveltest.test
to: /home/vagrant/code/public
type: "apache"
databases:
- laraveltest
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
name: rhind-laraveltest
hostname: rhind-laraveltest
- Add ssh fix to Vagrantfile inside the
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
section:
config.vm.boot_timeout = 6000
config.ssh.insert_key = false
config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"]
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
- Edit the Windows host file and add the Laravel host entry
## Vagrant ##
192.168.10.10 laraveltest.test
- Launch Vagrant
vagrant up
- Login into Vagrant
vagrant ssh
- Check if files are moved into the vm
ls code/
- Quit the shell
exit
- Inside
/etc/nginx/sites-enabled/[WEBSITETENAME].test:
do:
sudo nano /etc/nginx/sites-enabled/[WEBSITETENAME].test
and edit:
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; => fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
- Also disable xdebug via:
sudo nano /etc/php/7.4/mods-available/xdebug.ini
- Reboot nginx service and fpm with:
sudo service nginx restart
sudo service php7.4-fpm restart
- Error 503: List the error logs and open the correc one
ls /var/log/apache2/
tail -f /var/log/apache2/segnoprogetto-area-sciencepark.test-error.log
If error FCGI: attempt to connect to Unix domain socket /var/run/php/php7.4-fpm.sock (*) failed
run:
sudo service php7.4-fpm start
- List all vagrant installed instances
vagrant global-status