环境: 数据库:192.168.115.12 nginx:192.168.115.31 php:192.168.115.31 zabbix:192.168.115.31
一、安装nginx1.10.1 1.编译软件 1
2
3
4
5
6
| # yum install pcre-devel openssl-devel
# tar xf nginx-1.10.1.tar.gz
# cd nginx-1.10.1
# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-select_module--with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_sub_module --with-http_stub_status_module
# make
# make install
|
2.修改配置文件 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| server {
listen 80;
server_name 192.168.115.31;
location / {
root html;
index index.php index.html index.htm;
}
location ~ \.(php|php5)?$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
|
二、安装php5.5.38 1.编译软件 zabbix3.0需要php5.4以上的版本 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| #tar xf php-5.5.38.tar.gz
#cd php-5.5.38
./configure \
--prefix=/usr/local/php\
--with-mysql=mysqlnd\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--with-iconv-dir=/usr/local/libiconv\
--with-freetype-dir\
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr\
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization\
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| --enable-gd-native-ttf\
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags\
--enable-static \
--with-xsl \
--with-fpm-user=nginx\
--with-fpm-group=nginx\
--enable-ftp \
--enable-opcache=no
|
2.修改php配置 修改php.ini 1
2
3
4
| max_execution_time = 300
max_input_time = 300
post_max_size = 16M
date.timezone = Asia/Shanghai
|
3.php以fpm方式运行 提供php-fpm配置文件 1
2
3
| # cd /usr/local/php/etc
# cp php-fpm.conf.default php-fpm.conf
# /usr/local/php/sbin/php-fpm
|
4.测试php是否正常运行 提供测试页面 1
2
3
4
| # cat index.php
<?php
phpinfo();
?>
|
三、安装zabbix3.0.4 1.软件编译 1
2
3
4
5
| # useradd zabbix -s /sbin/nologin -M
# tar xf zabbix-3.0.4.tar.gz
# cd zabbix-3.0.4
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make && make install
|
2.数据库配置 1
2
3
4
5
6
7
| mysql>CREATE DATABASE zabbix CHARACTER SET utf8;
mysql>GRANT ALL ON zabbix.* TO 'zabbix'@'192.168.%.%' IDENTIFIED BY '123456';
# /usr/local/mysql/bin/mysql -uzabbix -h192.168.115.12 -p123456
mysql> use zabbix;
mysql> source /root/zabbixsql/schema.sql
mysql> source /root/zabbixsql/images.sql
mysql> source /root/zabbixsql/data.sql
|
初始化sql文件在源码包/root/zabbix-3.0.4/database/mysql目录下 3.修改zabbix-server配置文件 1
2
3
4
5
6
7
| LogFile=/usr/local/zabbix/logs/zabbix_server.log
DBHost=192.168.115.12
DBName=zabbix
DBUser=zabbix
DBPassword=123456
Timeout=4
LogSlowQueries=3000
|
4.启动zabbix-server服务 提供服务启动脚本 1
2
3
| # cp /root/zabbix-3.0.4/misc/init.d/fedora/core/zabbix_* /etc/init.d/
# chmod +x /etc/init.d/zabbix_server
# service zabbix_server start
|
5.配置web环境 1
| # cp -rp /root/zabbix-3.0.4/frontends/php /usr/local/nginx/html/zabbix
|
|