Installing Laravel Homestead Windows 8.1 64bits

  • Installation & Setup

    • Prepare

#Installlation & Setup

First make sure that you have the latest window updates, I had problem with new installed system because of this.

Git

I recommend this options on Git Installation

2016-01-16 13_46_13-Git 2.7.0 Setup 2016-01-16 13_46_46-Git 2.7.0 Setup 2016-01-16 13_47_14-Git 2.7.0 Setup 2016-01-16 13_48_02-Laravel Homestead - Laravel - The PHP Framework For Web Artisans 2016-01-16 13_48_45-Laravel Homestead - Laravel - The PHP Framework For Web Artisans 2016-01-16 13_49_20-Greenshot

Vagrant & VirtualBox

The Default installation is Okay

Reboot Windows

Setup

Open Git Bash and run this

vagrant box add laravel/homestead

==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://atlas.hashicorp.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) virtualbox
2) vmware_desktop

Choose 1

Possible Errors:

  1. Vagrant is attempting to interface with the ui in a way that requires tty.
    • Try installing Git first thenVagrant
    • Or type this on Git Bash export VAGRANT_DETECTED_OS=cygwin
  2. The box ‘boxname’ could not be found.
    • Try Checking if you have internet o Git Bash
    • Sometimes  windows ssl with curls is the problem Vagrant use his own curl.exe, but also Git comes with one usally I rename vagrant curl.exe and that fixed the problem “”C:\\HashiCorp\\Vagrant\\embedded\\bin/curl.EXE”
  3. IF you get some crazy errors try googling and using the –debug line so you can see whats going on .

Homestead

Now we get Homestead, still inside of Git Bash run this code

git clone https://github.com/laravel/homestead.git Homestead

cd Homestead

bash init.sh

The Homestead.yaml file will be placed in your ~/.homestead directory.

Create SSH keys

In Git Bash run

 ssh-keygen -t rsa -C "[email protected]"

Use the defaults and without passphrase

Create your Shared Folder

Inside Git Bash run

mkdir Code

Start Vagrant

Inside Git Bash run this

cd Homestead/ && vagrant up

Configure Putty

Putty : Download

First we need to create a ppk file for putty, open Puttygen

Click in import Key then on file name put this %userprofile%\.ssh\id_rsa

then click Save private key

Open Putty

on Host name put 127.0.0.1  Port : 2222

Then click Ssh -> Auth

on Private key file . Click Browse and selected the new ppk file created

Go back to session and click save and test. It should connect automaticly without password

the default password for vagrant is

user : vagrant

pwd : vagrant

PuttyGen PuttyGen Open private key Click Save private Key Open Putty Putty select private key

Mysql Default Root Password

The default root password is secret

Create your first Laravel Project

Open Putty connect your Homestead

cd code

laravel new project

 

Getting wrong $_SERVER[‘SERVER_NAME’] on Nginx PHP5-FPM

I was testing some old code that used $_SERVER[‘SERVER_NAME’] to get the sub domain, but I was getting *.mysite.com  no matter what was the sub domain, so looking on the nginx site config file on the php section had and include

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params; #<-- includes fastcgi paramters file
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}

which calls a file /etc/nginx/fastcgi_params

On the file I found the problem, nginx send as SERVER_NAME parameter the $server_name var, which in this case because we use wildcards  anysubdomain.mysite.com will trigger *.mysite.com  and that’s why the nginx variable get $server_name get that domain

To fix this problem I just comment that $server_name and use the $http_host variable.

fastcgi_param  SERVER_NAME        $http_host; #$server_name;

Restart nginx and test

sudo service nginx restart

 

400 Bad Request – request header or cookie too large

I was getting this error on heavy usage Cookie App in nginx, so looking at nginx documation, found the solution

Terminal

you can go global or site specific, because large_client_header_buffers. it’s only valid in http or server contexts,

so for only site specific I went server way

sudo nano /etc/nginx/sites-enabled/yoursite.com

Add this line on your server context

large_client_header_buffers 4 16k;

you can play with size of the client buffer, I need only 4 16k , default is  4 8k

restart nginx and test

sudo service nginx restart

 

How to remove Skype Ads

It is really easy to block Ads on Skype,  we only need to restrict two domains and that’s all.

So lets start

Control Panel

Open your control panel window then click on Network and Internet then on Internet Options, Click on the Security tab and finally click on Restricted sites, you will see a Sites button, click it and add this two domains

apps.skype.com

g.msn.com

Restricted Sites Sites

 

Press Close and now we need to remove the Place Holder where the Ads is

Remove the Ad Placeholder

Press Win Key + R  and type %appdata% and then click Skype and look for your for a folder with your Skype name in there you should see a file named config.xml open it with your favorite editor, I recommend Sublime or Notepad++ search for AdvertPlaceholder and change the 1 to 0 save and exit there you have it , restart your Skype and there should be no more Ads!

RunOpen with sublimeChange AdvertPlaceholder to 0