latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

ModSecurity
Server Settings

Update ModSecurity configuration file

This function sets the contents of a specified ModSecurity™ configuration file. The system stages any changes to the configuration file. To deploy the changes, call WHM API 1's modsec_deploy_rule_changes function.

Important:

When you disable the Web Server role, the system disables this function.

get/modsec_set_config_text

Query parameters

configstring required
Example:modsec2.example.conf

The configuration file name.

textstring required
Example:SecRule REQUEST_URI "example" "deny,id:123456789" SecAction "pass,auditlog,id"

The configuration text.

Response

HTTP Request was successful.

{"stackTrail":"paths:/modsec_set_config_text:get:responses:200:content:application/json:schema:properties:data","oasType":"schema","type":"unknown"}

Example response

{
  "metadata": {
    "command": "modsec_set_config_text",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}