[comment]: # translation:outdated

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

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

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

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

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

来自指定IP地址的用户将能够在维护模式期间正常工作。

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

[comment]: # ({3308453e-dcfd8b13})
#### 配置

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

    // Maintenance mode. 
    define('ZBX_DENY_GUI_ACCESS', 1);

    // Array of IP addresses, which are allowed to connect to frontend (optional).
    $ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');

    // Message shown on warning screen (optional). 
    $ZBX_GUI_ACCESS_MESSAGE = 'We are upgrading MySQL database till 15:00. Stay tuned...';

|参数                              详|信息|
|---------------------------------------|------|
|**ZBX\_DENY\_GUI\_ACCESS**|打开维护模式:<br>1 – 维护模式已打开，其他的数字表示未打开|
|**ZBX\_GUI\_ACCESS\_IP\_RANGE**|允许连接到前端的IP地址数组（可选）<br>例:<br>`array('192.168.1.1', '192.168.1.2')`|
|**ZBX\_GUI\_ACCESS\_MESSAGE**|您可以输入一条消息来通知用户有关维护的信息（可选）|

[comment]: # ({/3308453e-dcfd8b13})

[comment]: # ({new-5c07cdc7})

::: 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).|

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

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

下图显示了在维护模式下访问Zabbix前端的情况。屏幕每30秒刷新一次，以便在维护结束后，无需用户干预即可恢复正常状态。

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

在 ZBX\_GUI\_ACCESS\_IP\_RANGE 中定义的IP地址可以一直访问前端。

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