Installing and Configuring Laravel on cPanel and VDS
Laravel Architecture on Shared Hosting
For security, only the public/ folder of a Laravel application should be web-accessible. Core framework files must reside outside public_html.
Directory Structuring
- Upload Laravel core files to
/home/user/laravel_app/. - Move the contents of
laravel_app/public/into/home/user/public_html/. - Update paths in
public_html/index.php:
require __DIR__.'/../laravel_app/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel_app/bootstrap/app.php';Environment Configuration (.env)
Set APP_ENV=production, APP_DEBUG=false, configure database credentials, and set your production APP_URL.
Creating Storage Symlink
Run via SSH: php artisan storage:link to link public storage to application disk storage.
Was this helpful?
Thanks for your feedback!