Getting Started

Deploying to Production

Deployment Script

Within your deployment script, where you would normally add any other Artisan commands, add the following command:

    
1php artisan autoload:deploy

Or, if you are using Laravel Forge,

    
1$FORGE_PHP artisan autoload:deploy

This command will:

  • Clear all the cache (file, database, Filament components, and page cache)
  • Run the php artisan optimize command
  • Cache all Filament components and icons
  • Run the php artisan autoload:cache command (that will statically cache all Pages)
  • If you have Conduit installed, it will also run it's deploy command as well

Static Caching

To take advantage of static page caching, you will need to update the Nginx configuration to look for your static HTML files to be served.

Nginx

If you're using Laravel Forge, navigate to your site and at the top right of the page, click the "Edit Files" dropdown and then click the "Edit Nginx Configuration" link.

This will open a modal popup of the Nginx for you to edit. Add the following edits to that file and then click "Save."

    
1location = / {
2 try_files /page-cache/pc__index__pc.html /index.php?$query_string;
3}
4 
5location / {
6 try_files $uri $uri/ /page-cache/$uri.html /page-cache/$uri.json /page-cache/$uri.xml /index.php?$query_string;
7}

CSRF Token Requirements

In order for CSRF tokens to be refreshed on your static HTML files, you will need to make sure to include the following script tag on every Page that will be static cached. Read more about this script here.

    
1@vite(['js/autoload.js'], 'vendor/autoload')

This line will make an API call to fetch the fresh CSRF token from your Laravel backend and update it within your HTML on page load.

Laravel Scheduler

In order to use the publish scheduling feature, you will need to enable the Laravel Scheduler to continuously run.

Laravel Forge can handle this for you by following their documentation or you can manually set it up with a long-running process.

    
1php artisan schedule:run
Code highlighting provided by Torchlight