zabbix-nginx-web

版本

zabbix 4.0

更新yum ,安装基本包

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


yum -y install epel-release
yum -y install bash-completion,wget

下载并安装zabbix 仓库

wget http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum localinstall zabbix-release-4.0-2.el7.noarch.rpm

安装 zabbix-web-mysql

yum -y install zabbix-web-mysql

停止并禁用httpd

systemctl stop httpd;systemctl disable httpd

安装nginx 及php-fpm

yum -y install nginx php-fpm

将nginx 加入到apache组里面

usermod -aG apache nginx

配置 PHP-FPM:

cat > /etc/php-fpm.d/zabbix.conf << eof
 [zabbix]
user = apache
group = apache
listen = /var/run/php-fpm/zabbix.sock
listen.owner = apache
listen.group = apache
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
eof

启动php-fpm 服务

systemctl restart php-fpm
systemctl enable php-fpm

配置nginx

 cat > /etc/nginx/conf.d/zabbix.conf << eof
server {
    listen       80;
    server_name  your_domain_or_ip;

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

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm/zabbix.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PHP_VALUE "date.timezone=Asia/Shanghai";
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}
eof

启动nginx

systemctl enable nginx
systemctl start nginx

直接通过http://ip 访问。

posted @ 2024-09-03 18:04  lifei888  阅读(9)  评论(0)    收藏  举报