Thứ Tư, 5 tháng 10, 2016

Laravel 5 Tutorial : Setting Up Laravel 5.3 on Shared Hosting Server


Laravel 5.3 Tutorial - On this Lessons I'll show you how to Setting Up Laravel 5.3 on Shared Hosting Server, we have some guide to deploy your Laravel 5 application onto a shared hosting server.

By default, the Laravel folder structure assumed that the public folder is within the application itself. This is the high level folder structure :

Setting Up Laravel 5.3 on Shared Hosting Server

Fist step, we will upload all file and folders that in "public" folders into public_html your Hosting Server Directory.

Next, in your Hosting Server, just create new folder and rename it with "laravel" or whatever you want in root directory. So that the directory structure becomes similar to :

....
cgi-bin Directory
laravel Directory
public_html Directory
etc ....

Than, upload all the other directories/files (config, app, bootstrap, config, database, etc...) into laravel folder.

Netx, Update your index.php that stored on public_html/index.php, please remember, you just need to update index file in public_html Directory, not in Laravel Directory.

Change this line

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';

to

require __DIR__.'/../laravel/bootstrap/autoload.php';

$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

and save your index.php

Next, we need to update .htaccess file too. Edit your .htaccess file (don't delete anything, just add this script in the buttom lines) that stored on public_html/.htaccess

RewriteEngine On
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_URI} !^
RewriteRule ^(.*)$ /$1 [L]

Next, edit your Database configuration in .ENV file with your new server configuration.

Finally, upload your database into Hosting Server.

See you next lessons...

Không có nhận xét nào:

Đăng nhận xét