# urbestack-domain-modsec-set

First published 19 Nov 2026 (release 0.2.30) · Unchanged since publication

UrbeStack release 0.2.35 command, run as root in the server shell.

## Usage

```
urbestack-domain-modsec-set --name DOMAIN [--mode follow|off|logging|blocking] [--choice none|off|logging|blocking]
```

## Description

Sets the ModSecurity mode or the owner's choice for a domain. --mode sets the administrator's mode for the domain. It can raise or lower the server mode, so a domain can be off on a server in blocking mode or be inspected on a server with ModSecurity off. Use --mode follow to inherit the server mode again.

--choice sets the owner's mode. The command rejects a choice stronger than the administrator's mode for the domain. The owner can choose a mode only while the administrator's mode for the domain is logging or blocking. Use --choice none to clear the choice. A choice equal to the administrator's mode is treated as no choice. If the owner has chosen a mode, the weaker of the two modes takes effect. Otherwise, the administrator's mode for the domain applies.

Updates the domain's virtual host and UrbeStack's ModSecurity configuration for Apache, tests the Apache configuration and reloads Apache. If Apache rejects the configuration, the command restores the previous configuration and discards the changes. It returns the same details as urbestack-domain-modsec-show.

## Same in the API

- [PATCH /domains/{name}/modsec](https://urbestack.com/docs/api/patch-domains-name-modsec.md): Set a domain's ModSecurity mode or its owner's choice

## Command family: domain

- [urbestack-domain-add](https://urbestack.com/docs/commands/urbestack-domain-add.md): Adds a hosted domain to a customer account.
- [urbestack-domain-alias-add](https://urbestack.com/docs/commands/urbestack-domain-alias-add.md): Adds an alias to an existing domain so Apache serves both names from the same document root.
- [urbestack-domain-alias-del](https://urbestack.com/docs/commands/urbestack-domain-alias-del.md): Removes an alias and updates Apache, DNS and mail configuration.
- [urbestack-domain-del](https://urbestack.com/docs/commands/urbestack-domain-del.md): Deletes a domain and its subdomains, along with their Apache virtual hosts, PHP-FPM pools, mailboxes, certificates and statistics.
- [urbestack-domain-list](https://urbestack.com/docs/commands/urbestack-domain-list.md): Lists domains in name order or returns a single domain by name.
- [urbestack-domain-log](https://urbestack.com/docs/commands/urbestack-domain-log.md): Reads a domain's access, error or PHP error log.
- [urbestack-domain-modsec-show](https://urbestack.com/docs/commands/urbestack-domain-modsec-show.md): Shows the server's ModSecurity mode, the administrator's mode for the domain, the owner's choice and the mode in force.
- [urbestack-domain-redirect-add](https://urbestack.com/docs/commands/urbestack-domain-redirect-add.md): Adds an HTTP redirect from a path on a domain.
- [urbestack-domain-redirect-del](https://urbestack.com/docs/commands/urbestack-domain-redirect-del.md): Removes redirects for a source path on a domain.
- [urbestack-domain-set](https://urbestack.com/docs/commands/urbestack-domain-set.md): Changes settings for an existing domain and synchronizes the DNS zones UrbeStack manages.
