---
title: "corestack_nginx_backup_guard_set"
url: https://docs.corefinity.com/mcp/tools/corestack_nginx_backup_guard_set
type: tool
last_updated: 2026-11-13
feature: nginx-rules
related:
  - https://docs.corefinity.com/api/reference/site-settings/update-site-backup-guard.md
  - https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md
---
# corestack_nginx_backup_guard_set

**Switch Corefinity's backup-file rule.** Switch Corefinity's backup-file rule on or off for an environment row. While it is on, the row answers 404 for .sql and .sql.gz files anywhere in its web root, so a database dump left there cannot be downloaded. It is on by default; switch it off only for a site that serves such files on purpose. The change applies at once. The current state is the backup_guard key of corestack_nginx_rules_get. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Runs as a task: yes

## When to use it

Switch Corefinity's backup-file rule on or off for an environment row. While it is on, the row answers 404 for .sql and .sql.gz files anywhere in its web root, so a database dump left there cannot be downloaded. It is on by default; switch it off only for a site that serves such files on purpose. The change applies at once. The current state is the backup_guard key of corestack_nginx_rules_get.

`backup_guard` in corestack_nginx_rules_get says whether the rule is offered (`available`), whether the row wants it (`enabled`), whether its nginx files carry it (`applied`), whether a change is on its way (`pending`) and whether the last change was not confirmed (`uncertain`: it is applied again within a few minutes). WordPress, Laravel, Shopware 5 and Custom PHP rows already block these files through their platform (`platform_enforced`), so their rule is always on; it is written on Magento 2 and Shopware rows. A started change answers a task on its `nginx_backup_guard_change` operation; a row that already wants and carries what you ask answers `operation: null`. The explainer (corestack_nginx_rules_explain) names the rule when it is why a path answers 404.

## Inputs

- `site_id` (integer, ≥ 1, required): The environment row.
- `enabled` (boolean, required): true to block backup files, false to let the site serve them.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "enabled": {
      "description": "true to block backup files, false to let the site serve them.",
      "type": "boolean"
    },
    "site_id": {
      "description": "The environment row.",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "enabled"
  ],
  "type": "object"
}
```

## Refusals

- `wrong_platform`: the row's platform blocks these files itself, so it cannot be switched off.
- `not_available`: the rule is not offered yet, so it cannot be switched on.
- `nginx_rules_locked`: Corefinity staff hold this environment's nginx rules.
- `files_missing`: the environment's nginx files are not ready yet, or carry the rule in a form the Control Panel does not write.
- `busy`: another change runs on the environment.
- `stale`: the row changed while the change was being started; read it again.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_nginx_backup_guard_set",
  "arguments": {
    "site_id": 4211,
    "enabled": false
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_nginx_backup_guard_set with site_id 4211, enabled false. (Switch Corefinity's backup-file rule.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [PUT /api/corestack/sites/{site}/nginx-rules/backup-guard](https://docs.corefinity.com/api/reference/site-settings/update-site-backup-guard.md)
- Guide: [Web server rules](https://docs.corefinity.com/guides/sites/site-settings/web-server-rules.md)
