1、 找不到url
2、 服务器无法处理当前请求,PHP解析出错
3、 服务器无法处理当前请求,权限不足
1、 找不到url
浏览器报错:The requested URL /zabbix/ was not found on this server
日志报错:File does not exist: /var/www/html/zabbix
原因:Apache缺少指向/usr/share/zabbix相关目录的配置文件
解决办法:配置/etc/httpd/conf.d/zabbix.conf文件内容如下
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
mv /etc/httpd/conf.d/zabbix.conf{,.bak}
cat >>/etc/httpd/conf.d/zabbix.conf<<EOF
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value date.timezone Asia/Shanghai
</IfModule>
</Directory>
<Directory "/usr/share/zabbix/conf">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/api">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/include">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/include/classes">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
EOF
/etc/init.d/httpd restart
2、 服务器无法处理当前请求,PHP解析出错
浏览器报错:10.0.0.106 is currently unable to handle this request.
日志报错:PHP Parse error: syntax error, unexpected '[' in /usr/share/zabbix/index.php on line 32
原因:PHP版本太低,需要安装PHP5.4以上的版本
解决办法:CentOS6默认yum安装的是php5.3,需要构建yum源安装或进行源码安装高版本PHP
配置命令
yum remove php php-mysql php-cli php-xml php-gd php-common php-bcmath php-pdo php-mbstring -y
rpm -qa|grep php
rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm
yum install php55w php55w-mysql php55w-cli php55w-xml php55w-gd php55w-common php55w-bcmath php55w-pdo php55w-mbstring -y
php -v
3、 服务器无法处理当前请求,权限不足
浏览器报错:10.0.0.106 is currently unable to handle this request.
日志报错:PHP Fatal error: require_once(): Failed opening required '/etc/zabbix/web/maintenance.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /usr/share/zabbix/include/classes/core/ZBase.php on line 276
原因:apache对/etc/zabbix/web/maintenance.inc.php文件的权限不足导致处理中断
解决办法:更改/etc/zabbix/web/目录的属主
解决命令:
chown -R apache. /etc/zabbix/web/
/etc/init.d/httpd restart
ls -l /etc/zabbix/web/