Zabbix监控nginx状态

1. lnmp搭建


#1.1 安装后配置

# 修改/usr/local/nginx/conf/nginx.conf配置文件
修改/usr/local/nginx/conf/nginx.conf配置文件
[root@nginx ~]# cd /usr/local/nginx/conf/
[root@nginx conf]# vim nginx.conf
http {
    server {
        listen       80;
        server_name  localhost;		##注:若想用域名访问,请修改localhost
            location / {
            root   html;
            index  index.php index.html index.htm;		##注:添加index.php
            }
    }
        location ~ \.php$ {
            root           html;		##注:网页文件存放目录,在本机的/usr/local/nginx/html/目录下
            fastcgi_pass   192.168.40.134:9000;		##注:修改为php服务器地址
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /www/$fastcgi_script_name;		##注:将$/scripts修改为根目录(192.168.91.130服务器的存放网页文件的目录)
            include        fastcgi_params;
        }
}

检查配置文件是正确
[root@nginx conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重启nginx
[root@nginx ~]# nginx -s reload
[root@nginx ~]# ss -antl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128      *:80                   *:*                  
LISTEN     0      128      *:22                   *:*                  
LISTEN     0      100    127.0.0.1:25                   *:*                  
LISTEN     0      128     :::22                  :::*                  
LISTEN     0      100    ::1:25                  :::*     


在存放网页的目录中创建index.php文件(与配置文件中的“root”项对应)
[root@nginx ~]# vim /usr/local/nginx/html/index.php
[root@nginx ~]# cat > /usr/local/nginx/html/index.php <<EOF
> <?php
>     phpinfo();
> ?>
> EOF

1.2 访问php网页

2. Zabbix部署

环境说明:

环境 IP 要安装的应用
服务器 192.168.30.130 lnmp架构
zabbix
serverzabbix agent
客户端 192.168.30.129 zabbix agent

2.1 zabbix服务端安装

# 安装依赖包
[root@swk ~]# yum -y install net-snmp-devel libevent-devel
安装过程略....

# 下载zabbix
[root@swk src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz

# 解压
[root@swk src]# tar xf zabbix-4.0.3.tar.gz

# 创建zabbix用户和组
[root@swk ~]# groupadd -r zabbix
[root@swk ~]# useradd -r -M -s /sbin/nologin -g zabbix zabbix

# 配置zabbix数据库
[root@swk ~]# mysql -uroot -psuwenkang123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值