Configuring your Laravel 5.4 Application just in 5 easy steps.
After installing Laravel framework on the server your next step is to configure your app.
Below are the basic steps to configure a Laravel Application.
Setting Public Directory of Laravel accessible to web server.
Once Laravel is successfully installed, you need to configure your webserver document / web root to Laravel’s public directory.The index.php files in this directory is entry point of all requests in your application.
Changing Directory Permissions
Set the write permission for the storage and bootstrap/cache directory.
$ sudo cd /dir/of/laravel $ sudo chmod -R 777 /storage /bootstrap/cache
Generating Application Key
Next setup after changing permissions of storage and bootstrap/cache directory is to generate and set your application key to a random string. If you have installed Laravel via composer ,the the key has already been set for you by running
php artisan key :generate command.If not you can manually set it by editing .env file for laravel’s root folder.
APP_ENV=local APP_KEY=base64:cszyJhy/ZRU+MqQ68MW9vkVeRhCV/0Xb6oOyeKvEg9Q= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=localhost/wfm/public
Typically, application key is 32 characters long random string the is used to encrypt user sessions and other files in Laravel.
Configuring Environmental files.
Laravel provides easy way to manage your application to different environments such as local, production, testing.You can configure your application environment by editing .env file of Laravel framework route directory.If you installing laravel via composer this file will automatically be generated.A sample .env file looks like below.
APP_NAME=Laravel APP_ENV=local APP_KEY=base64:eiofjJewgm4fv4wSEV30fxtXZcm7epXypl07vui/vi4= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET=
In Laravel, you can easily configure your database from “config/database.php” file.
In this file you can configure your database setting like driver, database_server , default database to use etc.