This is an example of how to set up a Laravel application to deploy on Kinsta’s Application Hosting services from a GitHub repository.
Laravel is a regular PHP-based application, so during the deployment process, Kinsta automatically installs dependencies defined in your composer.json file.
- Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Laravel.
- Laravel requires the
APP_KEYenvironment variable to be set. You can generate an app key yourself locally, or you can use this online Laravel key generator.
- In MyKinsta, add an application with the Hello World Laravel repository. In Environment variables, in Key 1, enter
APP_KEY, and in Value 1, paste the key generated from Step 2, select Available during runtime and Available during build process.
- The Start command can be left blank for the web process as Kinsta automatically detects the required command during the first deployment.
The app is available as soon as the build finishes and a Laravel page loads at your application’s URL.
Laravel requires the
APP_KEY environment variable to be set. If this key is not set, you will see a 500 error page served by Laravel. You can generate an app key yourself locally, or you can use the online Laravel key generator. Once you have a key, you can add it as an environment variable.
Web Server Setup
The default web process is
heroku-php-apache2. This example includes an .htaccess file that reroutes all requests to public/index.php for Laravel. If needed, you can change this command when adding your application (Set up your processes) or on the application’s Processes page after deployment. You can use:
php artisan serve --host 0.0.0.0 --port 8080