zabbix4.0 使用nginx前端安裝
注:環境需求:centos7
1、安裝阿里雲yum源:
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.1/rhel/7/x86_64/zabbix-release-4.1-1.el7.noarch.rpm rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.1/rhel/6/x86_64/zabbix-release-4.1-1.el6.noarch.rpm2、安裝zabbix
yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb zabbix-agent -y
3、啟動mysql
systemctl start mariadb create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to [email protected] identified by 'password';quit;
4、初始化和匯入資料
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix5、為zabbix 伺服器配置資料
/etc/zabbix/zabbix_server.conf DBPassword=zabbix6、啟動zabbix
systemctl restart zabbix-server zabbix-agent httpd
7、安裝php
安裝php7 epel 源: wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum install -y php72w-fpm.x86_64 php72w-devel.x86_64 php72w-common.x86_648、server 端配置
[[email protected] ~]# grep '^'[a-Z] /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password
DBPort= 3306
StartPollers=100
StartTrappers=200
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
9、agent 端配置
[[email protected] ~]# grep '^'[a-Z] /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=l-zabbix1
Include=/etc/zabbix/zabbix_agentd.d/*.conf
10、php 配置
cat /etc/zabbix/web/zabbix.conf.php
11、新增php.ini 時區
/etc/php.ini
12、nginx 配置
cat /etc/nginx/conf.d/vhost/zabbix.conf
server
{
listen 80;
server_name zabbix.truegrowth.cn;
index zabbix.html zabbix.php;
root /usr/share/zabbix/;
access_log /tmp/zabbix_access.log main;
error_log /tmp/zabbix_error.log;
location ~ .*\.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
13、登入安裝
使用者名稱:Admin 密碼:zabbix