Deploying Laravel on VPS.

(1239 hits) 13 Dec 2018 in Web Development by Dario Mindoro




1.
go to folder on the same level of public_html and create new folder for your project and upload all the laravel file exect the public folder

2.
Upload the contents of the public directory from your project into the public_html directory on your web server (i.e. /home/accountname/public_html/) .

3.
Modify the laravel/bootstrap/app.php file to set the public.path value. Add the following block of code to the file before the “Bind Important Interfaces” block. Adjust the path as needed if you are deploying the application on a subdomain.

$app->bind('path.public', function ()
{
    return __DIR__.'/../../public_html';
});

4. Modify the public_html/index.php file to adjust the paths to point to the directory containing the Laravel core files. Refer to the following code block. Again, adjust the paths as needed if you are deploying the application on a subdomain.

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

note: if open_basedir error: edit /home/admn/conf/web/[webdomain].httpd.conf and add the path of laravel app folder to the open_basedir value

-------------------------------------

NOTE: if you are cloning your existing app, you need to generate new app key

$  php artisan key:generate


Tagged in : Laravel, Php

avatar
Author :
Dario Mindoro

Founder of Mindworksoft.com. Full-stack developer of PsIndex, interested in AI and digital electronics