October 06, 2018


When you normally install Laravel Framework in a updated system (Chrome and Firefox, laravel.dev privacy error) you'll get a privacy error in web browser. Following steps will save your time.

First you need to download and install Xampp and Composer.



Install Laravel Framework

Open command prompt and run below command. It will download and install Laravel Framework for you, in C:\Users\USER_NAME directory. 

composer create-project laravel/laravel your-project-name 


Config Xampp for Virtual Host

Open httpd-vhosts.conf file via your favorite notepad. In default it locates at C:\xampp\apache\conf\extra directory. Add following lines at the end of the file.

# VirtualHost for LARAVEL.TEST
<VirtualHost laravel.test:80>   
 DocumentRoot "C:\Users\USER_NAME\your-project-name\public"   
 ServerAdmin laravel.test   
<Directory "C:\Users\USER_NAME\your-project-name">         
 Options Indexes FollowSymLinks         
 AllowOverride All         
 Require all granted   
</Directory>
</VirtualHost>
   
Then open and edit hosts file with admin privileges(run notepad as admin) which located on C:\Windows\System32\drivers\etc directory. add following line and save it.

127.0.0.1 laravel.test

Now you have successfully installed and configured done for Laravel Framework. Navigate to laravel.test  via your favorite web browser.

Bonus Configurations


Enable SSL (HTTPS) for Laravel localhost

If you have done above steps, again open httpd-vhosts.conf file via your favorite notepad. In default it locates at C:\xampp\apache\conf\extra directory. and then also add following lines.


<VirtualHost laravel.test:443>
  DocumentRoot "C:\Users\USER_NAME\your-project-name\public"
  ServerAdmin laravel.test
  SSLEngine on
  SSLCertificateFile "conf/ssl.crt/server.crt"
  SSLCertificateKeyFile "conf/ssl.key/server.key"
  <Directory "C:\Users\USER_NAME\your-project-name">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
 </Directory>
</VirtualHost>


Solving Laravel Specified key was too long error

Duet o laravel default database character set you will get following error if you're going to add some users to database.

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
For solve this error you need to edit AppServiceProvider.php which locates in /your-project-name/app/Providers directory.

Add following line after, namespace App\Providers;

use Illuminate\Support\Facades\Schema;

Add following line inside public function boot()


Schema::defaultStringLength(191);

After complete AppServiceProvider.php will look like below,


<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }
}

SHARE BUTTONS