Host a Laravel application
A Laravel site must serve its public folder. The project root, environment file and application logs must never be downloadable.
Before you begin
Confirm the PHP and extension requirements of your Laravel version, Composer access, a database and the ability to set the document root to the application’s public folder. Use a VPS if you need long-running workers that your plan does not support. If your plan has no terminal or SSH access, follow Install Laravel on shared hosting without terminal access.
Steps
- Upload the release outside the domain’s public directory. Point the domain document root to the release’s public folder; ask support if that control is unavailable. Do not expose the whole project as a workaround.
- Install production dependencies using the locked Composer file and build frontend assets from the project’s lockfile.
- Configure the production URL, database, mail and existing application key in the private environment file. Keep debug mode off. Preserve the existing key when moving a live application.
- Back up the database before running reviewed migrations. Confirm you have a compatible rollback plan; not every migration is reversible.
- Give the application user write access only to the required storage and bootstrap cache directories.
- Create the public storage link if your app uses it. Configure the scheduler and supported queue workers, then check logs and a real login/upload workflow.
Production settings and release commands
APP_ENV=production
APP_DEBUG=falsecomposer install --no-dev --prefer-dist --optimize-autoloader
php artisan storage:link
php artisan optimizeCheck the result
The home page, login, static assets, storage files and background jobs work over HTTPS. Requests for the environment file and private application files return a denial or not-found response. A 500 error should be investigated through private logs; never turn on public debug output.
Related articles
- Install Laravel on shared hosting without terminal access
- Choose a hosting environment
- Optimize Laravel
- Website backups
Last reviewed
2026-10-28
