aAPT
dDebian
fFFmpeg
jJava
mMercurial: Usage
oOCaml
pPostgreSQL

Home Applications

Zabbix

Installation (7.0 LTS, Debian 13, Nginx, Postgres)

Postgres

Install Postgres backend

apt install zabbix-server-pgsql

Prepare database

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

cd /usr/share/zabbix-server-pgsql
zcat schema.sql.gz images.sql.gz data.sql.gz | sudo -u zabbix psql zabbix

Configure Zabbix server

nano /etc/zabbix/zabbix_server.conf

Uncomment and set DBPassword

Web Frontend

Install PHP Fast CGI Process Manager

apt install php8.4-fpm (php8.4-curl php8.4-ldap)

Create Zabbix pool

/etc/php/8.4/fpm/pool.d/zabbix.conf
[zabbix]
user = www-data
group = www-data

listen = /var/run/php/zabbix.sock
listen.owner = www-data
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 200

php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/sessions/

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

And optionally disable default www pool:

cd /etc/php/8.4/fpm/pool.d
mv www.conf www.conf.orig

Add Nginx site

/etc/nginx/sites-available/zabbix.conf
server {
    listen          443 ssl;
    server_name     <domain>;

    ssl_certificate /etc/dehydrated/ssl/certs/<domain>/fullchain.pem;
    ssl_certificate_key /etc/dehydrated/ssl/certs/<domain>/privkey.pem;
    ssl_session_timeout 30m;
    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    root    /usr/share/zabbix;
    index   index.php;

    location = /favicon.ico {
        log_not_found   off;
    }

    location / {
        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;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_pass    unix:/var/run/php/zabbix.sock;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index   index.php;

        fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
        fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
        fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

        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;
    }
}

Agent

Install Zabbix Agent

apt install zabbix-agent2

Post-install

Connect to Web UI, generate initial config and save it to /etc/zabbix/zabbix.conf.php and adjust permissions

chown www-data:www-data /etc/zabbix/zabbix.conf.php