Server templates
Server templates (/templates, under Advanced) are reusable provisioning
blueprints. A template captures the exact stack the add-server composer builds —
components, PHP versions, swap, timezone, auto-updates and SSH hardening — plus
optional fine-tuning (php.ini, MariaDB, Redis, cron jobs, daemons). Build one once,
then pick it when adding a server to provision automatically, or apply it to an
existing box to bring it up to standard. It’s an account-level page (your whole
fleet, not a single server) and available on all plans.
Build a template, step by step
Section titled “Build a template, step by step”- Click New template to open the builder drawer.
- (Optional) Capture from a server — pick an online server and MZPanel reads its real stack into the builder, so you can turn a box you already like into a reusable blueprint instead of assembling from scratch.
- Give it a Name and a Description (what this stack is for).
- Assemble the Stack — the same composer as the add-server flow: pick components (MariaDB, Redis, Docker, phpMyAdmin, Supervisor, firewall…), PHP versions, swap size, timezone, auto-updates and SSH hardening.
- If you captured a box, the builder may show an Includes fine-tuning panel (php.ini per version, MariaDB tunables, Redis, cron jobs, daemons). You can keep it or Drop it.
- Click Save template. It appears as a card with summary chips (PHP versions, component count, firewall, swap, SSH-hardened, “Tuned”).
What else you can do
Section titled “What else you can do”Each template is a card with a footer showing when it was updated and how many times it’s been applied. From a card you can:
- Apply — roll the stack onto one or more online servers. The drawer lists your fleet with online/offline pills, lets you Select all targets, and streams the provisioning output per server live with a per-box status (running → done / failed).
- Reconfigure (force) — a checkbox in the Apply drawer that re-asserts the template’s settings even where a box already differs, and (for tuned templates) replays the captured fine-tuning. Off by default; provisioning alone never overwrites a box’s existing settings.
- Edit — reopen the builder to change the stack. Edits apply to future provisions/applies only; already-provisioned servers are untouched.
- Duplicate — clone a template as
<name> (copy)to branch a variant. - Delete — remove the blueprint (with a confirm). Servers provisioned from it keep their stack — nothing is uninstalled.
- Start from a template — when you add a server, the composer has a Start from a template picker that pre-fills every option from a saved blueprint.
How it works
Section titled “How it works”The page is control-plane state driven by the /v1/templates API — nothing runs on
a box until you apply.
| Action | API | What happens |
|---|---|---|
| List | GET /v1/templates | your org’s templates, newest-updated first |
| Create | POST /v1/templates | store { name, description?, config, tuning? } |
| Edit | PATCH /v1/templates/:id | update name/description/config/tuning |
| Duplicate | POST /v1/templates | re-create with (copy) name |
| Delete | DELETE /v1/templates/:id | remove the row |
| Capture | POST /v1/templates/capture | derive a config + tuning from a server’s inventory |
| Apply | POST /v1/servers/:id/provision/remediate | dispatch provision install from the template |
Templates are stored in the control plane (org-scoped, with a case-insensitive-unique name per org) — MZPanel does not keep VPS state itself, so a template is just a saved recipe, not a live mirror of any box.
Apply loads the template server-side (authoritative), builds the provision args
from its config, and dispatches an idempotent provision install job to the target’s
agent — which installs/optimizes only what’s missing, then records provenance
(applied_template_id) and increments the template’s used-count. For a tuned
template with Reconfigure on, the dashboard replays the captured fine-tuning as
its own follow-up jobs (php.config-set-raw, db.tune-apply, cache.redis-config-set,
cron.add, daemon.create) after the provision finishes.
Capture reads the source server’s pushed inventory (extensions, PHP, security, facts, cron, daemons) to reconstruct the stack; the full MariaDB tune and Redis config are pulled with live reads and merged in client-side. Capture never persists — it just prefills the builder for you to name and save.
API & automation
Section titled “API & automation”Server templates live in the control plane, so the on-box mz CLI does not apply
here — drive them through the MZPanel API instead (API access is a Max-plan
feature). List, create and apply templates with the same endpoints the dashboard
uses:
GET /v1/templatesPOST /v1/templates { name, config, tuning? }POST /v1/servers/:id/provision/remediate { template_id, force? }The remediate call returns a stream_url you can follow for live provisioning
output. See the API reference. The provision run itself is the same
engine as a fresh install, so the actual on-box work is standard provision install.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- Apply and Capture need the agent online. Both dispatch to (or read from) a live agent — offline servers are shown but not selectable as targets, and the capture picker only lists online boxes.
- Provisioning is additive by default. A plain Apply installs/optimizes only what’s missing; it will not overwrite settings a box already has. Turn on Reconfigure (force) to re-assert template values (this may restart services) and to replay a tuned template’s fine-tuning.
- Deleting a template doesn’t touch servers. It only removes the blueprint; provisioned boxes keep their stack. The confirm warns you if the template has already been applied.
- Swap isn’t captured. Capture reads the stack from inventory, but swap size isn’t in inventory — a captured template keeps the composer default (2g). Adjust it in the builder before saving if the source box differs.
- Names are unique per account. Two templates can’t share a name (case-insensitive); saving a duplicate name returns a “name already exists” error.
Related
Section titled “Related”- Add & connect a server — where Start from a template provisions a new box.
- Monitor a server — services, updates and storage a template sets up.
- API reference — driving templates from your own automation.