Skip to content

Commit 1d610fe

Browse files
authored
Update README.md
1 parent 4133223 commit 1d610fe

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1+
# Nginx with WAF
2+
3+
[官方ngxin Dockerfile](https://github.com/nginxinc/docker-nginx/blob/1.15.12/mainline/alpine-perl/Dockerfile)的基础上,增加[ModSecurity V3版本](https://github.com/SpiderLabs/ModSecurity/tree/v3/master)作为WAF。
4+
5+
## 使用方法
6+
7+
### 下载镜像
8+
9+
```bash
10+
docker pull traceflight/nginx-with-waf:1.15.12
11+
```
12+
13+
### 运行
14+
15+
```bash
16+
docker run -d -v /path/to/conf/:/etc/nginx/conf.d/ \
17+
-v /path/to/log/:/var/log/nginx/ \
18+
-p 80:80 -p 443:443 \
19+
traceflight/nginx-with-waf:1.15.12
20+
```
21+
22+
或使用docker-compose:
23+
24+
```yaml
25+
version: '3'
26+
services:
27+
nginx:
28+
image: traceflight/nginx-with-waf
29+
restart: always
30+
volumes:
31+
- /path/to/conf/:/etc/nginx/conf.d/
32+
- /path/to/log/:/var/log/nginx/
33+
ports:
34+
- "80:80"
35+
- "443:443"
36+
```
37+
38+
### Waf配置
39+
40+
默认ModSecurity为开启状态,其使用的owasp-modsecurity-crs规则集有可能会阻断正常的应用数据,如需要关掉ModSecurity,则需要在网站的配置中增加如下语句:
41+
42+
```
43+
modsecurity off;
44+
```
45+
46+
## 依赖项目
47+
48+
* [Nginx](https://github.com/nginxinc/docker-nginx)
49+
* [ModSecurity](https://github.com/SpiderLabs/ModSecurity)
50+
* [owasp-modsecurity-crs](https://github.com/SpiderLabs/owasp-modsecurity-crs)
51+
52+
## 与官方Dockerfile的区别
53+
54+
可通过如下命令查看当前版本与Nginx官方Dockerfile的区别:
55+
56+
```bash
57+
diff <(curl -fsL https://github.com/nginxinc/docker-nginx/raw/1.15.12/mainline/alpine-perl/Dockerfile) <(curl -fsL https://github.com/traceflight/nginx-with-waf/raw/1.15.12/Dockerfile)
58+
```
59+
160
# NGINX with libModSecurity + ModSecurity-nginx connector + OWASP ModSecurity Core Rule Set (CRS)
261

362
The dockerfile of this container has been copied from the [official nginx repo (alpine-perl variant)](https://github.com/nginxinc/docker-nginx/blob/1.15.3/mainline/alpine-perl/Dockerfile) and has been modified to add [ModSecurity library (v3)](https://github.com/SpiderLabs/ModSecurity/tree/v3/master) + [ModSecurity nginx connector](https://github.com/SpiderLabs/ModSecurity-nginx) + [OWASP ModSecurity Core Rule Set (CRS)](https://github.com/SpiderLabs/owasp-modsecurity-crs)
@@ -11,5 +70,5 @@ When you provide your configuration you can enable modsecurity. Please refer to
1170
If you're curious to know the difference from this dockerfile and the upstream one:
1271

1372
```bash
14-
diff <(curl -fsL https://github.com/nginxinc/docker-nginx/raw/1.15.3/mainline/alpine-perl/Dockerfile) <(curl -fsL http://github.com/traceflight/docker-nginx-modsecurity/raw/master/Dockerfile)
73+
diff <(curl -fsL https://github.com/nginxinc/docker-nginx/raw/1.15.12/mainline/alpine-perl/Dockerfile) <(curl -fsL https://github.com/traceflight/nginx-with-waf/raw/1.15.12/Dockerfile)
1574
```

0 commit comments

Comments
 (0)