An image

Corporate Blogs

Install and Configure Laravel 5.1 and do simple authentication

E-Commerce Businesses Need a Mobile App

Install And Configure Laravel 5.1 and do simple authentication
Here, I am going to explain how to install a fresh Laravel 5.1 package in Ubuntu and how to configure and how to do a simple authentication process in Laravel 5.1.

Install Laravel 5.1 – Server Requirements

The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine:
1. PHP >= 5.5.9
2. OpenSSL PHP Extension
3. PDO PHP Extension
4. Mbstring PHP Extension
5. Tokenizer PHP Extension

Installing Laravel 5.1

Laravel uses Composer to handle all dependencies. You need to install Composer first if composer is not installed. In case the Composer is already installed, skip the below steps and go to step “Install Laravel 5.1 with following command:”.
Composer installation steps for Ubuntu:


Composer reference for different platforms:

Install Laravel 5.1 with the following command:


Provide the permission using below commands for “storage” and “bootstrap”, which are available inside the blog directory, and created.


After the installation is done, create the virtual host and point the document root to “your_application_path/blog/public” since “public” is the document root of the laravel application. This is where the Laravel application will receive all the requests.

Here I am providing how to create virtual host in nginx in ubuntu:

virtual host ref:–3

Quick steps for nginx


That’s it… virtual host created successfully.

Run this url in broswer You will get the Laravel 5.1 page. Thus the Laravel 5.1 package is installed successfully.

Then create the database “your_db_name” and configure .env file which is available inside the blog directory.


After configuring the database connections I will do the following steps for simple authentication.


Add the below lines in


Create the view file as given in the link

Use the above link how to create blade files for authentication process.

Load the url

The register form loads, and when you submit the form you will get an error.

Run these below comments in terminal inside your project directory:
(ref :

To create the user table:


After running the above command successfully, Users table will be created in your database with basic columns.

Now do submit auth/register to create first user account.

Basing configure in


Use this command to create the admin controller:



Add this line “return view(‘admin.index’);” in index method of app/Http/Controllers/AdminController.php without the double quotes
and create “admin” directory inside resources and create files index.blade.php. Then add this line in index.blade.php file:


Add middleware authentication checking for your secured routes:

auth is used to access the particular page for logged in users only, these pages are not accessible to guests.




Thats it… this url will be and will be accessible only for logged in users.
Now you can use to access the login and submit your created credentials. It will work fine.

Professional Life of an IT Consultant Interview with Valentin Crettaz
Written by
An enthusiastic Tech Lead with 6 plus years of experience in Web development arena. Owns legitimate experience in CorePHP, Laravel, Symfony, CakePHP, Wordpress, Joomla. Behalf, a young Aspiring "Travel admirer" craves to live with Nature.

Leave a Comment

Rate this Blog!