[comment]: # translation:outdated

[comment]: # ({8fc97588-8fc97588})
# 5 前端维护模式

[comment]: # ({/8fc97588-8fc97588})

[comment]: # ({fca7c17f-fca7c17f})
#### 概述

可以暂时禁用 Zabbix Web 前端以禁止对其进行访问。这对于保护 Zabbix 数据库免受用户发起的任何更改非常有用，从而保护数据库的完整性。

当 Zabbix 前端处于维护模式时，可以停止 Zabbix 数据库并执行维护任务。

用户使用已定义IP 地址将能够在维护模式下正常访问前端。

[comment]: # ({/fca7c17f-fca7c17f})

[comment]: # ({331a19a4-dcfd8b13})
#### 配置

为了启用维护模式，必须修改 `maintenance.inc.php` 文件（位于网络服务器上 Zabbix HTML 文档目录的 /conf 中）以取消注释以下行：

    // 维护模式。
    define('ZBX_DENY_GUI_ACCESS', 1);

    // IP 地址数组，允许连接到前端（可选）。
    $ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');

    // 警告屏幕上显示的消息（可选）。
    $ZBX_GUI_ACCESS_MESSAGE = 'We are upgrading MySQL database till 15:00. Stay tuned...';

[comment]: # ({/331a19a4-dcfd8b13})

[comment]: # ({new-ae331777})

::: notetip
Mostly the `maintenance.inc.php` file is located in `/conf` of Zabbix HTML document directory on the
web server. However, the location of the directory may differ depending on the operating system and a web server it uses.

For example, the location for:

-  SUSE and RedHat is `/etc/zabbix/web/maintenance.inc.php`.
-  Debian-based systems is `/usr/share/zabbix/conf/`.

See also [Copying PHP files](/manual/installation/install#copying-php-files). 
:::

|Parameter|Details|
|--|--------|
|**ZBX\_DENY\_GUI\_ACCESS**|Enable maintenance mode:<br>1 – maintenance mode is enabled, disabled otherwise|
|**ZBX\_GUI\_ACCESS\_IP\_RANGE**|Array of IP addresses, which are allowed to connect to frontend (optional).<br>For example:<br>`array('192.168.1.1', '192.168.1.2')`|
|**ZBX\_GUI\_ACCESS\_MESSAGE**|A message you can enter to inform users about the maintenance (optional).|

Note that the [location](/manual/installation/install#copying-php-files) of the `/conf` directory will vary based on the operating system and web server. 

[comment]: # ({/new-ae331777})

[comment]: # ({987fdc44-987fdc44})
#### 显示

在维护模式下尝试访问 Zabbix 前端时，将显示以下屏幕。屏幕每 30 秒刷新一次，以便在维护结束时无需用户干预即可返回正常状态。

![](../../../assets/en/manual/web_interface/frontend_maintenance.png)

ZBX\_GUI\_ACCESS\_IP\_RANGE 中定义的 IP 地址将能够像往常一样访问前端。

[comment]: # ({/987fdc44-987fdc44})
