пятница, 5 июля 2013 г.

Zabbix + Nginx + PostgresDB

Assuming you already have running nginx and postgres and are going to install Zabbix server. Download and install Zabbix. Then you'll need to install FastCGI for PHP support and several additional packages:
# apt-get install zabbix-server-pgsql zabbix-frontend-php \
    php5-pgsql php5-fpm
You should be prompted to configure postgres database for zabbix during the installation. If not, refer to the documentation on how to do it manually.

Lets proceed to adding PHP support to Nginx for Zabbix. Add the following block to your 'server' in nginx.conf:
location /zabbix {
    if ($scheme ~ ^http:){
        rewrite ^(.*)$  https://$host$1 permanent;
    }
    
    alias               /usr/share;
    index               index.php;
    error_page          403 404 502 503 504  /zabbix/index.php;

    location ~ \.php$ {
        if (!-f $request_filename) { return 404; }
        expires         epoch;
        include         /usr/local/nginx/conf/fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_index   index.php;
        fastcgi_pass    127.0.0.1:9000;
    }

    location ~ \.(jpg|jpeg|gif|png|ico)$ {
        access_log      off;
        expires         33d;
    }
}
Modify 'include' directive to point to your nginx configuration directory and 'alias' - to zabbix installation dir. Note that if zabbix is installed into
/usr/share/zabbix
set alias to
/usr/share
Now set fastcgi to run on port 9000 and not using socket. Modify
/etc/php5/fpm/pool.d/www.conf
and set:
listen = 127.0.0.1:9000
Now Zabbix page can be opened in your browser: http://<server_ip_or_name>/zabbix. In case it doesn't check all the settings above and nginx and fastcgi logs to fix the problem. Once done proceed with installation steps on the opened page.

Комментариев нет:

Отправить комментарий