Before deploying to Laravel Cloud, there are a few things you should do to prepare your Statamic site:
- Right now, Statamic's Git automation doesn't work on Laravel Cloud. You can work around this by either:
- You should move any assets from the local filesystem to Laravel Cloud's object storage feature.
If you don't want to move content to a database, we recommend using a VPS-based solution, like Laravel Forge.
Creating your application
Once you've created your Laravel Cloud account, click "New application" to get started.
If it's your first application, you'll be asked to connect your Git provider of choice (GitHub, GitLab or Bitbucket).
From there, select the repository you want to deploy, give it a name and pick the region where you want your application deployed.

Upon creation, you can setup any "resources" needed for your application, like a database or object storage bucket.

Make sure to click "Save" after making changes to your application's resources.
New applications on Laravel Cloud use PHP 8.4 by default. However, some of Statamic's third-party dependencies still need to be updated for PHP 8.4.
For the time being, we recommend downgrading to PHP 8.3 in your environment's settings.
Creating a database
If you're storing content and users in the database (which), you'll need to create a database cluster in Laravel Cloud. You can do this from the environment overview page:

Once you've created your database cluster, you'll probably need to import data from an existing database you might have, whether that be locally or from a staging server.
You can use a database GUI, like TablePlus to do this.
-
Open your existing database, select all of the tables, and right click "Export". Make sure to save your export as a
.sql
file. -
Connect to your new Laravel Cloud database using the "View credentials" button.
If you're using TablePlus (or another GUI that supports it), you can open the database directly from the "Deeplink" tab.
-
Finally, import your database by right-clicking the tables list and selecting "Import -> From SQL File". From here, you can choose the
.sql
file you just exported.
Creating an object storage bucket
Since the Git Automation doesn’t work on Laravel Cloud, we recommend moving assets to Laravel Cloud's object storage service.
You can create a new bucket from the environment overview page:

It'll ask you which filesystem disk the bucket should provide. This should match a disk in your config/filesystems.php
config file.
Once created, you can upload existing assets using an app like Transmit, Cyberduck, or any similar app that supports S3-compatible filesystems.
Deploying your application
Now that you've got everything set up, all thats left to do is trigger your first deployment. 🚀
If you're using Vite to build CSS/JavaScript, make sure to uncomment the npm
commands in your application's deployment settings.
For more information about Laravel Cloud, please see its documentation.
Troubleshooting
Upstream sent too big header while reading response header from upstream
You may encounter this error when submitting a form on the frontend, or updating content in the Control Panel.
You can fix it by changing your application's session driver from cookie
to another driver, like database
or redis
.
You can find more information about session drivers on the Laravel documentation.