Souce Install Zabbix 4.0 on CentOS 7 – Frontend

사전 설치 – Nginx

Souce Install Nginx on CentOS 7

사전설치 – php-fpm

Souce Install PHP-FPM on CentOS 7

사전설치 – MariaDB

Souce Install MariaDB 10.1 on CentOS 7

Frontend 복사

[root@172-16-11-5 /]# cp /data/apps/dn/zabbix-4.0.3/frontends/php /data/www/zabbix.umount.local

config 파일 수정

[root@172-16-11-5 /]# cp /data/www/zabbix.umount.local/conf/zabbix.conf.php.example /data/www/zabbix.umount.local/conf/zabbix.conf.php

:vi /data/www/zabbix.umount.local/conf/zabbix.conf.php

<?php
// Zabbix GUI configuration file.
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'localhost';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'zabbix_user_password';

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

php gd 모듈 설치

[root@172-16-11-5 /]# cd /data/apps/dn/php-7.1.25/ext/gd
[root@172-16-11-5 gd]# phpize
[root@172-16-11-5 gd]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config --with-jpeg-dir=/usr/local/ --with-png-dir=/usr/local/ --with-freetype-dir=/usr/local/
[root@172-16-11-5 gd]# make && make install

php bcmath 모듈 설치

[root@172-16-11-5 gd]# cd /data/apps/dn/php-7.1.25/ext/bcmath
[root@172-16-11-5 bcmath]# phpize
[root@172-16-11-5 bcmath]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 bcmath]# make && make install

php session 모듈 설치

[root@172-16-11-5 bcmath]# cd /data/apps/dn/php-7.1.25/ext/session
[root@172-16-11-5 session]# phpize
[root@172-16-11-5 session]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 session]# make && make install

php sockets 모듈 설치

[root@172-16-11-5 session]# cd /data/apps/dn/php-7.1.25/ext/sockets
[root@172-16-11-5 sockets]# phpize
[root@172-16-11-5 sockets]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 sockets]# make && make install

php mbstring 모듈 설치

[root@172-16-11-5 sockets]# cd /data/apps/dn/php-7.1.25/ext/mbstring
[root@172-16-11-5 mbstring]# phpize
[root@172-16-11-5 mbstring]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 mbstring]# make && make install

php gettext 모듈 설치

[root@172-16-11-5 mbstring]# cd /data/apps/dn/php-7.1.25/ext/gettext
[root@172-16-11-5 gettext]# phpize
[root@172-16-11-5 gettext]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 gettext]# make && make install

php mysqli 모듈 설치

[root@172-16-11-5 gettext]# cd /data/apps/dn/php-7.1.25/ext/mysqli
[root@172-16-11-5 mysqli]# phpize
[root@172-16-11-5 mysqli]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 mysqli]# make && make install

php curl 모듈 설치

[root@172-16-11-5 mysqli]# cd /data/apps/dn/php-7.1.25/ext/curl
[root@172-16-11-5 curl]# phpize
[root@172-16-11-5 curl]# ./configure --with-php-config=/data/apps/ln/php/bin/php-config
[root@172-16-11-5 curl]# make && make install

php 모듈 추가
: vi /data/apps/ln/php/etc/php.ini (맨 아래줄에 추가)

extension=gd.so
extension=bcmath.so
extension=session.so
extension=sockets.so
extension=mbstring.so
extension=gettext.so
extension=mysqli.so
extension=curl.so

php 재시작

[root@172-16-11-5 /]# systemctl restart php-fpm

nginx site config 작성
: vi /data/apps/ln/nginx/conf/sites-enabled/zabbix.umount.local.conf

server {
    listen      80;
    server_name zabbix.umount.local;

    charset     utf-8;

    access_log  logs/zabbix.umount.local.access.log   main;
    error_log   logs/zabbix.umount.local.error.log    crit;

    root        /data/www/zabbix.umount.local;
    index       index.php;

    client_max_body_size 128M;

    location ~ /\.ht {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_pass                    unix:/data/apps/ln/php/php-fpm.sock;
        fastcgi_index                   index.php;
        fastcgi_buffers                 256 16k;
        fastcgi_buffer_size             128k;
        fastcgi_connect_timeout         180s;
        fastcgi_send_timeout            180s;
        fastcgi_read_timeout            180s;
        fastcgi_busy_buffers_size       256k;
        fastcgi_temp_file_write_size    256k;
        fastcgi_max_temp_file_size      0;
        fastcgi_intercept_errors        on;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PHP_VALUE       mysqli.default_socket=/data/apps/ln/mariadb/mysql.sock;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
        expires max;
        access_log      off;
        log_not_found   off;

        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }
}

nginx 재시작

[root@172-16-11-5 /]# systemctl restart nginx

웹 브라우저로 site 확인
http://yourip_or_domain/

zabbix

You may also like...