Black Friday: 40% off for life · BLACKFRIDAY40Claim →
crabsmith Get started
Browse documentation
← All documentation

CrabPHP

On this page

Deploy a Crab application behind Caddy with automatic HTTPS. Crabsmith assigns a local port and keeps your app server running as a managed daemon.

Required services

On your server's Services tab, install Caddy and PHP. Add MySQL, PostgreSQL, or Redis if your app uses them.

Create the site

  1. Open your server's Sites tab, click New site, and choose CrabPHP.
  2. Follow the App → Code → Domain → Run steps: pick your repository and branch, enter your domain (or Free domain), and review the Run step.
  3. On Run, Run the app as a daemon is enabled by default (php cua start --port=<port>), and Crabsmith adds its restart command to your deploy script automatically.
  4. If your app needs database credentials or custom .env values before its first deploy, uncheck Deploy after creating, then click Create site.

On the first deploy, Crabsmith copies .env.example to .env, generates APP_KEY if empty, and sets APP_URL to your site's URL. The default deploy script is:

sh
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
php cua migrate
sudo systemctl try-restart crabsmith-daemon-<id>

Configure .env

Open the site's Environment tab, verify your production values (including the site's assigned port shown on the site page, for example 8001), and click Save:

ini
APP_DEBUG=false
APP_URL=https://example.com
SERVER_ADDRESS=tcp://127.0.0.1:8001

Deploy and verify

Click Deploy now. Crabsmith installs dependencies, runs php cua migrate, restarts your app daemon, and verifies it answers on its port.

Check the running daemon and its logs anytime under the site's Processes tab, and run one-off php cua commands under Commands. (If you turned off Run the app as a daemon during setup, create a daemon under Processes with php cua start --port=<your-site-port> and paste its restart line into Settings → Deployment.)