# Installing and Configuring Laravel on cPanel and VDS

https://bihostnet.com/en/knowledgebase/article/laravel-installation-configuration-cpanel-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

1. Upload Laravel core files to `/home/user/laravel_app/`.
2. Move the contents of `laravel_app/public/` into `/home/user/public_html/`.
3. 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.
