[GH-ISSUE #107] 有没有简化点的安装方式,比如安装包或docker包 #80

Closed
opened 2026-03-04 12:18:46 +03:00 by kerem · 8 comments
Owner

Originally created by @molixiaoge on GitHub (Sep 6, 2022).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/107

个人安装起来依赖库太多,配置也很复杂多样,比如我的安装过程如下:

系统: centos 7.5

1.通过 assets/guide.sh 发现只需要动态库,通过docker下载动态库,发现老是错误,后升级docker版本终于下载下来了。
2.然后 glibc版本过老,需要升级 gcc make 版本,网上搜了一大堆资料折腾了大半天,终于安装升级好。
3.后来要用ModSecurity ,需要自己编译,编译的又是少依赖和路径什么的。
4.折腾了好半天,好在最后终于运行了,但是配置什么的还是有点乱中间过程也做了很多事情。

能不能根据环境内容提供一些预编译包呢,就像 ngx_http_waf_module.so的提供方式一样,一般使用来看 只需ngx_http_waf_module.so 和modesecurity的动态库,可以根据主流操作系统提供使用包的方式么?

Originally created by @molixiaoge on GitHub (Sep 6, 2022). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/107 个人安装起来依赖库太多,配置也很复杂多样,比如我的安装过程如下: 系统: centos 7.5 1.通过 assets/guide.sh 发现只需要动态库,通过docker下载动态库,发现老是错误,后升级docker版本终于下载下来了。 2.然后 glibc版本过老,需要升级 gcc make 版本,网上搜了一大堆资料折腾了大半天,终于安装升级好。 3.后来要用ModSecurity ,需要自己编译,编译的又是少依赖和路径什么的。 4.折腾了好半天,好在最后终于运行了,但是配置什么的还是有点乱中间过程也做了很多事情。 能不能根据环境内容提供一些预编译包呢,就像 ngx_http_waf_module.so的提供方式一样,一般使用来看 只需ngx_http_waf_module.so 和modesecurity的动态库,可以根据主流操作系统提供使用包的方式么?
kerem 2026-03-04 12:18:46 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@stale[bot] commented on GitHub (Sep 13, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。

<!-- gh-comment-id:1245021081 --> @stale[bot] commented on GitHub (Sep 13, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。
Author
Owner

@ADD-SP commented on GitHub (Sep 16, 2022):

一直想这么干,比如提供一个 .deb 包之类的,只是不知道怎么制作这类东西,所以就拖着了。

<!-- gh-comment-id:1249255301 --> @ADD-SP commented on GitHub (Sep 16, 2022): 一直想这么干,比如提供一个 `.deb` 包之类的,只是不知道怎么制作这类东西,所以就拖着了。
Author
Owner

@molixiaoge commented on GitHub (Sep 19, 2022):

好的,感谢回复

<!-- gh-comment-id:1250465303 --> @molixiaoge commented on GitHub (Sep 19, 2022): 好的,感谢回复
Author
Owner

@stale[bot] commented on GitHub (Sep 26, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。

<!-- gh-comment-id:1257802697 --> @stale[bot] commented on GitHub (Sep 26, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 此 issue 因为最近没有任何活动已经被标记,如果在此之后的一段时间内仍没有任何活动则会被关闭。感谢您对项目的支持。
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

最近也是在加这个,有点费劲,一直加不进docker 官方模块,官方推荐方式,https://github.com/nginx/docker-nginx/blob/master/modules/README.md

mkdir -p modules/ngx_wa
wget -O Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile
echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' >modules/ngx_waf/source
echo 'flex bison' >modules/ngx_waf/build-deps
docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx .

@molixiaoge 是否可以分享下你的方式

<!-- gh-comment-id:2818213890 --> @freshgeek commented on GitHub (Apr 21, 2025): 最近也是在加这个,有点费劲,一直加不进docker 官方模块,官方推荐方式,https://github.com/nginx/docker-nginx/blob/master/modules/README.md mkdir -p modules/ngx_wa wget -O Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' >modules/ngx_waf/source echo 'flex bison' >modules/ngx_waf/build-deps docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx . @molixiaoge 是否可以分享下你的方式
Author
Owner

@ADD-SP commented on GitHub (Apr 21, 2025):

最近也是在加这个,有点费劲,一直加不进docker 官方模块,官方推荐方式,https://github.com/nginx/docker-nginx/blob/master/modules/README.md

mkdir -p modules/ngx_wa wget -o Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' >modules/ngx_waf/resource echo 'flex bison' >modules/ngx_waf/build-deps docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx .

@molixiaoge 是否可以分享下你的方式

本项目依赖蛮多的,具体是遇到了什么问题? @freshgeek

<!-- gh-comment-id:2818321988 --> @ADD-SP commented on GitHub (Apr 21, 2025): > 最近也是在加这个,有点费劲,一直加不进docker 官方模块,官方推荐方式,https://github.com/nginx/docker-nginx/blob/master/modules/README.md > > mkdir -p modules/ngx_wa wget -o Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' >modules/ngx_waf/resource echo 'flex bison' >modules/ngx_waf/build-deps docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx . > > [@molixiaoge](https://github.com/molixiaoge) 是否可以分享下你的方式 本项目依赖蛮多的,具体是遇到了什么问题? @freshgeek
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

出现报错了,上面步骤也有点问题,重新调了下,缺了 deb 依赖:

1.631 Fetched 9307 kB in 1s (6677 kB/s)
1.631 Reading package lists...
2.349 Reading package lists...
3.077 E: Unsupported file /tmp/packages/nginx-module-ngxwaf_1.27.5*.deb given on commandline
------
Dockerfile:73
--------------------
  72 |     FROM ${NGINX_FROM_IMAGE}
  73 | >>> RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \
  74 | >>>     apt-get update \
  75 | >>>     && . /tmp/packages/modules.env \
  76 | >>>     && for module in $BUILT_MODULES; do \
  77 | >>>            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; \
  78 | >>>        done \
  79 | >>>     && rm -rf /var/lib/apt/lists/
  80 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update     && . /tmp/packages/modules.env     && for module in $BUILT_MODULES; do            apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb;        done     && rm -rf /var/lib/apt/lists/" did not complete successfully: exit code: 100

最新的步骤:



mkdir -p ngx_waf

wget -O Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile
# 写入包
echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' > ngx_waf/source
# 写入需要安装的依赖
echo 'flex bison' > ngx_waf/build-deps
# 预执行脚本
echo '' > ngx_waf/prebuild && chmod +x ngx_waf/prebuild 
# 检查文件
 tree ngx_waf
# 开始构建
docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx .




<!-- gh-comment-id:2818344200 --> @freshgeek commented on GitHub (Apr 21, 2025): 出现报错了,上面步骤也有点问题,重新调了下,缺了 deb 依赖: ``` 1.631 Fetched 9307 kB in 1s (6677 kB/s) 1.631 Reading package lists... 2.349 Reading package lists... 3.077 E: Unsupported file /tmp/packages/nginx-module-ngxwaf_1.27.5*.deb given on commandline ------ Dockerfile:73 -------------------- 72 | FROM ${NGINX_FROM_IMAGE} 73 | >>> RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \ 74 | >>> apt-get update \ 75 | >>> && . /tmp/packages/modules.env \ 76 | >>> && for module in $BUILT_MODULES; do \ 77 | >>> apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; \ 78 | >>> done \ 79 | >>> && rm -rf /var/lib/apt/lists/ 80 | -------------------- ERROR: failed to solve: process "/bin/sh -c apt-get update && . /tmp/packages/modules.env && for module in $BUILT_MODULES; do apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; done && rm -rf /var/lib/apt/lists/" did not complete successfully: exit code: 100 ``` 最新的步骤: ``` mkdir -p ngx_waf wget -O Dockerfile https://raw.githubusercontent.com/nginx/docker-nginx/refs/heads/master/modules/Dockerfile # 写入包 echo 'https://github.com/ADD-SP/ngx_waf/archive/refs/tags/v6.1.10.tar.gz' > ngx_waf/source # 写入需要安装的依赖 echo 'flex bison' > ngx_waf/build-deps # 预执行脚本 echo '' > ngx_waf/prebuild && chmod +x ngx_waf/prebuild # 检查文件 tree ngx_waf # 开始构建 docker build --build-arg ENABLED_MODULES="ngx_waf" -t third-nginx . ```
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

官方文档是拿这个举例,https://github.com/FRiCKLE/ngx_cache_purge 感觉可以参考这个git项目,创建对应的deb包

<!-- gh-comment-id:2818404321 --> @freshgeek commented on GitHub (Apr 21, 2025): 官方文档是拿这个举例,https://github.com/FRiCKLE/ngx_cache_purge 感觉可以参考这个git项目,创建对应的deb包
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#80
No description provided.