Giter VIP home page Giter VIP logo

verynginx's Introduction

VeryNginx

VeryNginx is a very powerful and friendly nginx .

中文文档

Notice

After v0.2 , The entry uri of control panel was moved to /verynginx/index.html

Description

VeryNginx is based on lua_nginx_module(openrestry). It implements advanced firewall(waf), access statistics and some other features. It strengthens the Nginx's functions, and provides a friendly Web interface.

VeryNginx online demo

User / Password: verynginx / verynginx

The full version of config guide can be found on: VeryNginx Wiki .

Nginx run status analyzing

  • Request per second
  • Response time
  • Net Traffic
  • Tcp connectinn num

Nginx status

Custom Action

VeryNginx supports custom actions, which can do a lot of things.

Custom action consists of two parts, Matcher and Action . Matcher is used to test whether a request meets the rule, Action is the logic you want to run.

The advantage of this design is that the Matcher includes all select rule, and can be reused, making use of rules to describe a very complex logic possible.

Matcher

A Matcher is used to select a part of all requests, a Matcher may contain one or more condition. The following conditions are currently supported:

  • Client IP
  • Host
  • UserAgent
  • URI
  • Referer
  • Request Args

When a request does not conflict with any of the conditions of the Matcher, the request will be selected by the Matcher

Action

Every Action refers to a Matcher , and will run on the requests selected by the Matcher

Now we have these Actions

  • Scheme Lock lock the scheme to http/https
  • Redirect Redirect request
  • URI Rewrite Do internal rewrite on the request
  • Browser Verify Use set-cookies and javascript to verify the client is a browser,and block traffic of the robot. This action may block the spider of search engine, so please enable it when under attack only.
  • Frequency Limit Limit max request time in a specified time period
  • Filter Block some request, can do the WAF

Matcher can select requests by multiple conditions, so with Filter Action, we got a powerful waf. The waf can filter requests with complex rules and return special status code when it block a request.

VeryNginx presets some simple filter rules, which can prevent simple SQL injection, Git and SVN file disclosure, directory traversal attacks and common scanning tool.

VeryNginx Matcher

VeryNginx filter

Backend

Every Backend refers to a Matcher,and will handle the requests selected by the Matcher

Now we have these Backend

  • Proxy Pass Proxy the request to other server
  • Static File Use local file to handle the request file

Request statistics

VeryNginx can record the request of URI, include these data of every URI:

  • All Request Count
  • Request count of every status code
  • Total Bytes
  • Avg Bytes
  • Total response time
  • Avg reqponse time

request statistics

Installation

Install Nginx / OpenResty

VeryNginx is based on OpenResty, so you need to install it first. But don't warry, VeryNginx gives a script to do it automatically.

python install.py install

Just run this command, openresty and verynginx will be installed automatically.

Want using custom nginx?

VeryNginx can install openresty automatically so that you needn't install nginx(openresty) manually.

But if you want use a nginx compiled by you self, that also ok. You can see that for some help

Use-own-nginx

Usage

Edit nginx configuration file

The configuration file of VeryNginx is /opt/verynginx/openresty/nginx/conf/nginx.conf, that's a demo. It just can let verynginx run so that you can see the dashboard of verynginx. If you want do something really useful, you need edit that file and add your own nginx configuration into it.

This configuration file add three include command to embeded verynginx into original nginx( openresty )

  • include /opt/verynginx/verynginx/nginx_conf/in_external.conf;
  • include /opt/verynginx/verynginx/nginx_conf/in_http_block.conf;
  • include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf;

These include command were placed outside a block, block http internal configuration, server configuration block inside, Remenber keep these three line when modifying. If you add a new Server configuration block or http configuration block, also need add suitable include line into it.

Start / Stop / Restart Service

#Start Service
/opt/verynginx/openresty/nginx/sbin/nginx

#Stop Service
/opt/verynginx/openresty/nginx/sbin/nginx -s stop

#Restart Service
/opt/verynginx/openresty/nginx/sbin/nginx -s reload

Configure VeryNginx on dashboard

After the service begin running, you can see server status and do config on dashboard.

The address of dashboard is http://{{your_machine_address}}/verynginx/index.html.

Default user and password is verynginx / verynginx. You should be able to work through all the options now.

The full version of config guide can be found in VeryNginx Wiki .

Trouble Shooting

If you have any problems during installation / configuration / use , you can refer the Trouble Shooting document.

Trouble Shooting

Tips

  • New configs will be effective immediately upon saving. It's not necessary to restart or reload nginx.

  • When you save config, VeryNginx will write all configs to /opt/verynginx/verynginx/configs/config.json.

  • If the chat in status page is stuck, you can click the gear icon in the upper right corner to turn off animation

  • If you lock yourself out of VeryNginx by doing something stupid, you can always delete config.json to revert VeryNginx to its default.

Update VeryNginx / OpenResty

Over time, VeryNginx own will evolve, and can also support newer version of OpenResty. New version of VeryNginx might support some new features or fix some old bugs. If you want to update locally installed VeryNginx, you just need pull the latest code from github to local, and run the following commands:

#Update VeryNginx
python install.py update verynginx

#Update OpenResty
python install.py update openresty

install.py will keep the old config.json and nginx.conf during update. So that you will not lost configuration after update.

Build VeryNginx docker Image

After cloning code to your local filesystem, you can run the following commands:

docker build -t verynginx .
docker run verynginx

Then you can navigate to your browser http://{{your_docker_machine_address}}/verynginx/index.html

Optionally you can run docker run -p xxxx:80 verynginx to map your container port 80 to your host's xxxx port

Donate

If you like VeryNginx, you can donate to support my development VeryNginx. With your support, I will be able to make VeryNginx better 😎.

PayPal

Support VeryNginx via PayPal

We Chat

Scan the QRcode to support VeryNginx.

Thanks

VeryNginx thanks for the help

Enjoy~

verynginx's People

Contributors

ajayk avatar alanzchen avatar alexazhou avatar anorpi avatar brooke9537 avatar bryant1410 avatar challengezhou avatar coldwinds avatar deepskyfire avatar halfcrazy avatar hex-ci avatar lancegin avatar laosb avatar linpeixun avatar maskshell avatar msg7086 avatar neverbehave avatar niinaranpo avatar ntavish avatar reynaldliu avatar solarhell avatar time-gate avatar uudiin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

verynginx's Issues

ngx_openresty-1.x.x.x.tar.gz to openresty-1.9.7.3.tar.gz

Hi,

I found that the software openresty updated to version 1.9.7.3, and the filename has been changed to openresty-1.9.7.3.tar.gz from ngx_openresty-1.x.x.x.tar.gz.

Pls modify the chapters "安装 Nginx / OpenResty" in file readme.md.

几个安全问题

VeryNginx做的很不错,必须赞。但还是有些安全问题。

管理面板的地址,在nginx的反代模式下能直接使用www.xxx.com(反代的域名)/verynginx/index.html直接访问到Verynginx的管理面板,这其实是很不安全的。而且我尝试了各种各样的改法都无法修正这问题。

在cookies的验证里 会出现verynginx字段,这类名字会成为一个强特征,让人有针对的地方。

建议能在这两个问题上有自主修改的空间。还是非常感谢作者。

无法保存配置

Ajax request failed [status code = 200]……
虽然微信告诉你了但是还是开个issue吧(

Translate to english?

Your project looks really nice, although I must admit that I don't speak your language :)

Is it possible to have it at least in English?

openresty编译安装过程中退出

make[2]: Leaving directory '/root/openresty-1.9.7.5/build/nginx-1.9.7'
make[1]: Leaving directory '/root/openresty-1.9.7.5/build/nginx-1.9.7'

copy VeryNginx files ...

cp -r -f ./verynginx /opt/verynginx
cp: cannot stat './verynginx': No such file or directory
*** The installing stopped because something was wrong
安装到这步还能用吗?

中文readme 安装后示例地址有错误

VeryNginx 启动后,可以通过浏览器访问管理面板来查看状态以及进行配置。
管理面板地址为 http://{{your_machine_address}}/VeryNginx/index.html。
实际应为小写
http://{{your_machine_address}}/verynginx/index.html

自己编译的nginx,怎么才能访问verynginx后台?

看了眼需要Included的3个文件并没有server信息

include /opt/verynginx/verynginx/nginx_conf/in_external.conf;
include /opt/verynginx/verynginx/nginx_conf/in_http_block.conf;
include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf;

是不是需要手动把\dashboard放到目录下然后访问?

500 Internal Server Error

:(
我在verynginx配置界面下修改了一下/verynginx路径之后报500,然后我直接删除了opt文件夹,再来安装verynginx,还是报500,之后我重新编译过nginx,之后还是报500,好神奇 😭

就第一次配置verynginx成功了,修改verynginx访问路径后,怎么样也不能成功了 :(

wiki dashboard 地址错误

The address of dashboard is http://{{your_machine_address}}/VeryNginx/index.html
应该是:
The address of dashboard is http://{{your_machine_address}}/vn/index.html

Extract default VeryNginx configuration

What about extracting default VeryNginx configuration from nginx.conf into a file alone then includes it from nginx.conf by default?
If there is any update to this configuration in the future, upgrading will be simpler.

管理页面404

打扰了,问个很初级的问题。利用install.py安装完毕,打开管理页面的时候404。进入到nginx.conf
location = / {
root html;
index index.html index.htm;
是因为需要修改指向的目录?

启动Request Summary 后,日志出错,规则可正常使用

我安装成功后,功能都正常,但在congfig-》Sunnary-》Request Summary 中启动attack_sql_0统计后,在error.log出现如下错误:
2016/07/14 18:55:14 [error] 8627#0: 22 failed to run log_by_lua: ...verynginx/verynginx/lua_script/module/request_tester.lua:111: API disabled in the context of log_by_lua*
stack traceback:
[C]: in function 'read_body'
...verynginx/verynginx/lua_script/module/request_tester.lua:111: in function <...verynginx/verynginx/lua_script/module/request_tester.lua:84>
...verynginx/verynginx/lua_script/module/request_tester.lua:18: in function 'test'
/opt/verynginx/verynginx/lua_script/module/summary.lua:52: in function 'log'
/opt/verynginx/verynginx/lua_script/on_log.lua:5: in function </opt/verynginx/verynginx/lua_script/on_log.lua:1> while logging request, client: 10.68.31.75, server: , request: "GET /verynginx/status HTTP/1.1", host: "10.68.16.65", referrer: "http://10.68.16.65/verynginx/index.html"
导致无法统计sql攻击数据,各位大神看是什么问题?
我的全部安装脚本如下(ubuntu 14 server 64位,安装过程无报错):
cd ~
sudo su
apt-get update
apt-get install make
ln -s /usr/bin/make /usr/bin/gmake
apt-get install gcc
apt-get install libpcre3 libpcre3-dev
apt-get install openssl libssl-dev
apt-get install git
git clone https://github.com/alexazhou/VeryNginx.git
cd VeryNginx
python install.py install
/opt/verynginx/openresty/nginx/sbin/nginx

怎样配置VeryNginx的访问端口?

已有域名的网站占用了80和443端口,访问VeryNginx会自动跳转到 域名加/VeryNginx/dashboard/index.html,这个页面的链接都打不开
怎样才能自定义配置VeryNginx的访问端口?
如同 server { listen:8080} 那样?

建议在 Request Summary 中给出域名的显示

全是uri的话根本看不清楚呀,或者加入根据域名进行筛选的选项?

PS:话说管理页面的 ABout 为什么会两个字都大写呢?笔误还是有意为之?
PS2:总体来说还是很赛艇,希望可以越来越强力

500 Error when post very big data

When post very big data or upload a file, nginx may cache the data to disk file, and get_post_args will raise a exception "requesty body in temp file not supported"

Installation failed

       -L/usr/local/VeryNginx/openresty-1.9.7.4/build/luajit-root/opt/verynginx/openresty/luajit/lib -Wl,-rpath,/opt/verynginx/openresty/luajit/lib -Wl,-E -lpthread -lcrypt -L/usr/local/VeryNginx/openresty-1.9.7.4/build/luajit-root/opt/verynginx/openresty/luajit/lib -lluajit-5.1 -lm -ldl -L/usr/local/VeryNginx/openresty-1.9.7.4/build/luajit-root/opt/verynginx/openresty/luajit/lib -lluajit-5.1 -lm -ldl -lpcre -lssl -lcrypto -ldl -lz
objs/addon/src/ngx_http_lua_regex.o: In function `ngx_http_lua_regex_free_study_data':
/usr/local/VeryNginx/openresty-1.9.7.4/build/nginx-1.9.7/../ngx_lua-0.10.2/src/ngx_http_lua_regex.c:1953: undefined reference to `pcre_free_study'
objs/addon/src/ngx_http_lua_regex.o: In function `ngx_http_lua_ffi_destroy_regex':
/usr/local/VeryNginx/openresty-1.9.7.4/build/nginx-1.9.7/../ngx_lua-0.10.2/src/ngx_http_lua_regex.c:2347: undefined reference to `pcre_free_study'
collect2: ld returned 1 exit status
make[2]: *** [objs/nginx] Error 1
make[2]: Leaving directory `/usr/local/VeryNginx/openresty-1.9.7.4/build/nginx-1.9.7'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/usr/local/VeryNginx/openresty-1.9.7.4/build/nginx-1.9.7'
make: *** [all] Error 2
*** The installing stopped because something was wrong

I was cloned the pro and run install in shell, but it failed, there some info here. So how do I do?

my server's env here:

[root@localhost VeryNginx]# uname -a
Linux localhost.localdomain 2.6.32-042stab113.11 #1 SMP Fri Dec 18 17:32:04 MSK 2015 i686 i686 i386 GNU/Linux

Can't save changed password.

I tried to change username and password,but i can't save it.
And there is only encrypt_seed.json in /opt/verynginx/verynginx/configs.

VeryNginx 后端Lua数据采集和前端JS界面显示的数据交互

您好,我想请问作者的是关于VeryNginx 后端Lua数据采集和前端JS界面显示的数据交互是如何实现的?JS是怎么样读取lua采集到的数据的,对性能有没有影响,我最近也在开发这个东西,但是是刚入门,懂得不是很多,求赐教,也可发邮件到我的信箱Email:[email protected],感谢您的指导~

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.