Symfony
On this page
Run Symfony on PHP-FPM behind Caddy with automatic HTTPS, .env.local production settings, Doctrine migrations, and Messenger workers.
Required services
On your server's Services tab, install Caddy and PHP. Add MySQL or PostgreSQL if your app uses Doctrine with a database server, and Node.js if you compile frontend assets during deploy.
Create the site
- Open your server's Sites tab, click New site, and choose Symfony.
- Enter your domain (or Free domain) and pick your repository and branch.
- Uncheck Deploy after creating if you need to add
DATABASE_URLto.env.localbefore the first deploy. - On the Run step, you can optionally turn on the Messenger worker daemon right away (or add it later under Processes).
- Uncheck Deploy after creating if you need to add
- Click Create site.
On the first deploy, Crabsmith pre-fills .env.local with APP_ENV=prod, generates APP_SECRET if empty, and sets DEFAULT_URI to your site's URL. The default Symfony deploy script is:
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
php bin/console cache:clear
if php bin/console list doctrine:migrations >/dev/null 2>&1; then php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration; fi
sudo systemctl reload "$PHP_FPM"If you use AssetMapper or Webpack Encore, add php bin/console asset-map:compile or npm ci && npm run build before cache:clear in Settings → Deployment.
Configure .env.local
Symfony commits defaults in .env and overrides them on the server with .env.local. Open the site's Environment tab, keep the generated APP_SECRET, and confirm APP_ENV=prod:
APP_ENV=prodIf you use Doctrine, create a database on your server's Databases tab and add DATABASE_URL:
# MySQL (URL-encode special characters in the password)
DATABASE_URL="mysql://example:your-password@127.0.0.1:3306/example?serverVersion=8.0&charset=utf8mb4"
# PostgreSQL
DATABASE_URL="postgresql://example:your-password@127.0.0.1:5432/example?serverVersion=16&charset=utf8"Click Save, then Deploy now so Symfony rebuilds its production cache and runs migrations.
Messenger workers and cron jobs
- Workers: if you didn't enable it during site creation, open Processes → New daemon with
php bin/console messenger:consume async --time-limit=3600, then add the daemon's restart line (sudo systemctl restart crabsmith-daemon-<id>) to your deploy script. - Cron jobs: add recurring commands under Processes → New schedule.
Verify
Open your site in a browser. Run one-off console commands anytime from the site's Commands tab, and check worker output under Processes → Logs.