Skip to content
ScriptElitePublic
forked from rehmatworks/fastcp

About

FastCP is a modern, fast, and secure control panel to run multiple PHP websites on an Ubuntu server.

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

FastCP

A lightweight control panel for Ubuntu and Debian servers, built on Caddy, PHP-FPM and MySQL.

Features

  • Sites with automatic HTTPS from Let's Encrypt, extra domains and redirects, one-click WordPress, and each site's PHP error log and access log in the panel. Domains behind Cloudflare's proxy are recognized.
  • Reverse proxy sites for Node.js, Python, Go or Docker applications: HTTPS and WebSockets in front of an application listening on a local port.
  • Your own Caddy configuration, server-wide or per site, in files FastCP never overwrites. Caddy checks them before they are applied.
  • PHP 8.x, several versions side by side and chosen per site. Patch releases are installed automatically every night, and new PHP versions are installed as soon as they are published.
  • Isolation: each account is a Linux user, each site runs in its own PHP-FPM pool as that user, the web server follows links only to files of the site's owner, and memory and CPU limits are enforced with systemd.
  • MySQL databases and users, with phpMyAdmin built in.
  • Backups with restic to SFTP, S3, rclone or a local folder, on a schedule, with per-site and per-database restore and zip downloads.
  • Cron jobs, SSH keys and SFTP, and a firewall (ufw) that keeps SSH and the panel reachable.
  • Signed updates from the panel, with automatic rollback if the new version does not start.

Requirements

  • Ubuntu 22.04 or newer, or Debian 12 or newer, on a clean server
  • 1 GB of memory (2 GB or more recommended) and 5 GB of free disk space
  • Root access

Install

curl -fsSL https://get.fastcp.org | sudo bash

The installer verifies the release signature, installs MySQL, Caddy, phpMyAdmin and the newest PHP, and prints the control panel address and the password of the fastcp administrator account. Open https://your-server-ip:2050 and sign in. The panel uses a self-signed certificate, so your browser warns about it on the first visit.

To install a specific release, set FASTCP_VERSION:

curl -fsSL https://get.fastcp.org | sudo FASTCP_VERSION=v3.2.8 bash

Accounts sign in with their Linux user name and password. root cannot sign in.

Updating

Go to Settings → Updates. The panel downloads the release, checks its signature, swaps the binaries and restarts. If the new version does not come up, the previous one is restored.

Updating from FastCP 2 works the same way. The first start of version 3 moves the server to the new layout: the panel and the web server stop running as root, certificates and sites are kept, and everyone has to sign in again.

How it works

 Browser ──HTTPS :2050──▶ fastcp            control panel, runs as fastcp-panel
                            │ Unix socket (peer credentials checked)
                            ▼
                          fastcp-agent      the only root process; applies changes
                            │
          ┌─────────────────┼───────────────────────┐
          ▼                 ▼                       ▼
   Caddy :80/:443     PHP-FPM pools           MySQL, users, cron,
   runs as caddy      one per site, run       SSH, firewall, backups
                      as the site's owner

The panel keeps its data in SQLite and pushes the desired configuration to the agent, which renders the Caddyfile and PHP-FPM pools, validates them, and reloads the services without dropping connections.

Caddy is FastCP's build of the upstream release (caddy/), published and signed with each FastCP release. It adds a file system for sites: a file reached through a symbolic link is served only if it belongs to the site's owner, like nginx's disable_symlinks if_not_owner.

Path Contents
/opt/fastcp/bin fastcp and fastcp-agent
/usr/local/bin/caddy FastCP's Caddy build
/opt/fastcp/data panel database and keys (owned by fastcp-panel)
/opt/fastcp/config generated Caddyfile and settings
/opt/fastcp/config/caddy.d your own Caddy configuration, applied from Settings → Web server
/var/lib/fastcp/caddy certificates (owned by caddy)
/home/<user>/apps/<site>/public a site's document root
/home/<user>/apps/<site>/logs a site's PHP error log
/var/log/fastcp/sites/<user>/<site> a site's access log, when access logs are on

Troubleshooting

systemctl status fastcp fastcp-agent fastcp-caddy
journalctl -u fastcp -u fastcp-agent -f
sudo systemctl restart fastcp-agent fastcp

A site's PHP errors and requests are under Sites → your site → Logs.

A file reached through a symbolic link returns 404 unless it belongs to the site's owner. Copy the file into the site, or change its owner, instead.

Behind Cloudflare's proxy, set SSL/TLS encryption to Full (strict) in Cloudflare. With Flexible, Cloudflare reaches the server over plain HTTP, so a site that redirects to HTTPS shows an explanation instead of loading. If the first certificate is not issued, turn off Always Use HTTPS in Cloudflare (or set the record to DNS only) until it is.

Uninstall

curl -fsSL https://github.com/rehmatworks/fastcp/releases/latest/download/uninstall.sh -o uninstall.sh
sudo bash uninstall.sh

The uninstaller asks before deleting accounts, sites, databases or packages.

Development

You need Go 1.27, Node.js 22 or newer, and on Linux libpam0g-dev.

make dev                 # panel on http://127.0.0.1:2050 with an in-memory agent (macOS)
cd web && npm run dev    # UI with hot reload on http://127.0.0.1:5173
make check               # go vet, go test (also in caddy/), svelte-check and vitest
make ui                  # rebuild cmd/fastcp/ui/dist (committed)
make caddy               # build FastCP's Caddy into bin/caddy
make docker              # install FastCP in a container with the real installer

The UI in web/ is Svelte 5 with TypeScript. Its build is committed to cmd/fastcp/ui/dist so that go build works without Node; CI fails if the committed build is out of date. Agent tests that need root run with FASTCP_INTEGRATION=1 in a Linux container:

docker run --rm -v "$PWD":/src -w /src -e FASTCP_INTEGRATION=1 golang:1.27-bookworm \
  sh -c 'apt-get update -qq && apt-get install -y -qq libpam0g-dev acl cron >/dev/null && go test ./...'

Releasing

  1. One time: create the signing key and add the private key as the FASTCP_SIGNING_KEY repository secret.
    go run ./tools/releasekey gen -pub internal/release/signing.pub -installer scripts/install.sh
    Commit both changed files. Never commit the private key.
  2. make bump V=x.y.z, then make ui, and commit.
  3. Push the commit and the tag vx.y.z together. The release workflow runs the checks, builds the binaries and FastCP's Caddy, and publishes them with SHA256SUMS and SHA256SUMS.sig.

License

MIT. See LICENSE.

About

FastCP is a modern, fast, and secure control panel to run multiple PHP websites on an Ubuntu server.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages