ELK——ELK+filebeat+kafka部署——(2)部署nginx+filebeat

部署nginx+filebeat

我们在虚拟机上部署nginx服务器,然后安装filebeat,使用filebeat收集nginx日志文件,把收集到的日志发送给logstash,让logstash过滤日志,把过滤完的日志保存到elasticsearch,然后通过kibana展示出来。

安装nginx

安装nginx

安装nginx依赖包:

[root@filebeat01 ~]# yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel  pcre pcre-devel

预编译:

[root@filebeat01 ~]# groupadd www

[root@filebeat01 ~]# useradd -g www www -s /sbin/nologin

[root@filebeat01 ~]# tar zxf nginx-1.10.3.tar.gz

[root@filebeat01 ~]# cd nginx-1.10.3/

[root@filebeat01 nginx-1.10.3]# ./configure --prefix=/usr/local/nginx --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre --with-http_ssl_module --with-http_gzip_static_module --user=www --group=www

[root@filebeat01 nginx-1.10.3]# make && make install

[root@filebeat01 nginx-1.10.3]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/

启动nginx

[root@filebeat01 ~]#nginx

查看端口号:

[root@filebeat01 nginx-1.10.3]# netstat -anplt | grep nginx

访问测试页

[root@filebeat01 ~]# curl http://localhost/index.html

你可能感兴趣的:(nginx,elk)