在Nginx的配置文件中配置一下access日志:
log_format access ‘$remote_addr – $remote_user [$time_local] “$request” ‘‘$status $body_bytes_sent “$http_referer” ‘‘”$http_user_agent” $http_x_forwarded_for’;
access_log /usr/local/openresty/nginx/logs/access.log;
安装一下goaccess:
yum -y install glib2 glib2-devel ncurses ncurses-devel geoip geoip-devel
cd /usr/localwget http://tar.goaccess.io/goaccess-0.9.2.tar.gztar zxvf goaccess-0.9.2.tar.gzcd goaccess-0.9.2./configure --enable-geoip --enable-utf8make && make installmake clean 3. GoAccess 使用方法进入 Nginx 日志所在目录命令行直接查看cd /usr/local/openresty/nginx/logsgoaccess -f access.log出来图了,日志格式选 NCSAhttp://www.fancycoding.com/log-analyse-using-goaccess/禁止IP访问:iptables -I INPUT -s 222.35.67.155 -j DROP 恢复IP访问:iptables -D INPUT -s 222.35.67.155 -j DROP
查看网卡:
nload -m eth1