Coder Social home page Coder Social logo

nginx-guard's Introduction

1.应用的功能

  • 1.根据攻击的内容信息把ip加入nginx的黑名单列表
  • 2.判断ip是否为国外网站,如果是国外的ip也加入访问黑名单
  • 3.根据提供的端口监听nginx进程是否存再,如果不存在,则重启nginx进程

2.使用手册

2.1.在nginx的配置文件中引入ip黑名单文件

我的安装路径是/usr/local/nginx/,根据你们自己的安装路径自行修改

#创建黑名单配置文件
mkdir /usr/local/nginx/conf/blackListIp.conf
# 修改nginx.conf文件,在http标签下引入blackListIp.conf文件
vi /usr/local/nginx/conf/nginx.conf
http {
 include blackListIp.conf;#添加当前行
}

2.2.修改应用的application.yml

如果nginx安装路径是/usr/local/nginx/,则只需要修改pingPort属性即可

属性 描述
matcher_list 恶意攻击的内容信息 多组用 "," 隔开
workspace nginx的安装路径
sbin 启动脚本路径
log access.log文件的路径
blackListIp 黑名单IP存储文件
pingPort 监控nginx使用的端口

2.3.运行程序

  • 1 mvn clean install
  • 2 上传release目录到服务器上面
  • 3 cd release/bin 目录下
  • 4 chmod 755 server.sh
  • 5 ./server.sh start

nginx-guard's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.