2026年7月6日月曜日

ZABBIX8.0 with postgres and nginx

■インストール前に PHP8.2以上が必要。

sudo dnf install -y epel-release
sudo dnf install -y http://rpms.remirepo.net/enterprise/remi-release-9.rpm # Rocky Linux9
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.5 -y
sudo dnf update php\* -y
php -v
PHP 8.5.8 (cli) (built: Jul  1 2026 03:46:27) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.5.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.8, Copyright (c), by Zend Technologies
sudo vi /etc/php-fpm.d/zabbix.conf 
  user = nginx
  group = nginx

sudo systemctl restart php-fpm
sudo systemctl restart nginx

[epel]
...
excludepkgs=zabbix*

# dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

# sudo -u postgres createuser --pwprompt zabbix
# sudo -u postgres createdb -O zabbix zabbix

# zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix

vi /etc/zabbix/zabbix_server.conf
DBPassword=password

vi /etc/nginx/conf.d/zabbix.conf
        listen          443 ssl;
        server_name     zabbix.dom.mydns.com;

# systemctl restart zabbix-server zabbix-agent2 nginx php-fpm
# systemctl enable zabbix-server zabbix-agent2 nginx php-fpm

# firewall-cmd --add-port=10050/tcp --zone=public --permanent
# firewall-cmd --add-port=10051/tcp --zone=public --permanent
# firewall-cmd --reload

# chown -R nginx:nginx /etc/zabbix
# chown -R nginx:nginx /usr/share/zabbix

setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
setsebool -P httpd_can_network_connect on
setsebool -P zabbix_can_network on

# dnf install zabbix-selinux-policy

【フロントエンドの設定】
user: Admin
password: zabbix


【NGINX】
vi /etc/nginx/conf.d/00_zabbix.conf  <<__EOF__
server {
        listen          443 ssl;
        server_name     zabbix.dom.mydns.com;

        # SSL証明書のパス(お使いの環境のパスに必ず書き換えてください)

        ssl_certificate     /etc/pki/tls/certs/localhost.crt;
        ssl_certificate_key /etc/pki/tls/private/localhost.key;

        # ドキュメントルートは「/ui」の手前までに変更
        root    /usr/share/zabbix/ui;
        index   index.php;

        client_max_body_size 5m;

        location = /favicon.ico {
                log_not_found   off;
        }

        # /zabbix/ でアクセスされた場合の挙動
        location / {
                #alias /usr/share/zabbix/ui;
                try_files $uri $uri/ =404;
        }

        location /assets {
                access_log      off;
                expires         10d;
        }

        location ~ /\.ht {
                deny            all;
        }

        location ~ /(api\/|conf[^\.]|include|locale) {
                deny            all;
                return          404;
        }

        location /vendor {
                deny            all;
                return          404;
        }

        # PHPの実行設定
        location ~ ^/(.+\.php)(/|$) {
                fastcgi_pass    unix:/run/php-fpm/zabbix.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index   index.php;

                fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix/ui;
                fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix/ui/$1;
                fastcgi_param   PATH_TRANSLATED /usr/share/zabbix/ui/$1;

                include fastcgi_params;
                fastcgi_param   QUERY_STRING    $query_string;
                fastcgi_param   REQUEST_METHOD  $request_method;
                fastcgi_param   CONTENT_TYPE    $content_type;
                fastcgi_param   CONTENT_LENGTH  $content_length;

                fastcgi_intercept_errors        on;
                fastcgi_ignore_client_abort     off;
                fastcgi_connect_timeout         60;
                fastcgi_send_timeout            180;
                fastcgi_read_timeout            180;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 256k;
                fastcgi_busy_buffers_size       256k;
                fastcgi_temp_file_write_size    256k;
        }
}
__EOF__






















0 件のコメント:

コメントを投稿

ZABBIX8.0 with postgres and nginx

■インストール前に PHP8.2以上が必要。 sudo dnf install -y epel-release sudo dnf install -y http://rpms.remirepo.net/enterprise/remi-release-9.rpm # Rocky L...