site_update
Update a site's document root and directory index. Commonly needed when a framework (e.g., Laravel) serves from a subfolder like /public.
Instructions
Change a site's document root (index_dir) and/or directory index, via PUT /api/sites/{site_id}. This is the ONLY way to repoint a site's docroot — nginx renders root from site.index_dir, NOT from the backend, so site_backend_update can't do it. Common need: frameworks that serve from a subfolder (Laravel/Symfony → /public). Pass framework:'laravel' to auto-append '/public' to the current docroot without computing the path yourself. This tool does a read-modify-write: it fetches the current site via site_get and resends the writable fields (docroot, index page, current certificate id, https/http2/http3/hsts flags) so the partial PUT doesn't blank out SSL or flags. ⚠️ UNVERIFIED ENDPOINT: the index_dir write path was not confirmable from the API spec (FastPanel has no OpenAPI). Run with dry_run:true, then a real call on a throwaway site, and check site_get afterwards. If index_dir does NOT change, capture the DevTools request the panel UI fires when you edit the docroot and report it so this can be corrected. WRITE — confirm:true required.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | ||
| dry_run | No | ||
| site_id | Yes | Site id from sites_list | |
| framework | No | Preset: sets docroot to <current_index_dir>/public. Ignored if index_dir is given explicitly. | |
| index_dir | No | New absolute document root, e.g. /var/www/www-root/data/www/<domain>/public. Omit if using `framework`. | |
| index_page | No | Directory index, e.g. 'index.php index.html'. Omit to keep current. |