Deploy laravel project (Voyager admin) on shared hosting

Posted: 26-05-2019 | Views: 6399
Deploy laravel project (Voyager admin) on shared hosting

I will cover the following here:

1.Compress the entire project folder on your local machine. You'll get a zip file – laravelApp.zip

2.Upload the laravelApp.zip to the root directory – the public_html.

3.Extract the laravelApp.zip here.

4.Create a database on your web host.There's easy way of importing and exporting databases from a local machine.login to PHPMyAdmin from your computer locate the database your project uses, from the toolbar find the export tool.

5.Open .env file. Change APP_URL=yourdomain and Database name and user

6.IMPORTANT ! first remove storage folder from "public_html/public", then create file for example link.php in public_html/ directory and add below lines

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
symlink($targetFolder,$linkFolder);
echo 'Success';

7.Then get yoursite.com/link.php

8.Create .htaccess file for (the public_html.). add below lines

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ public/index.php [L]

9.Everyting is ok.Deploy completed.

1 comments

Add comment