Skip to content

Commit 65871a9

Browse files
committed
build Nginx w/ module »njs«
Support for QuickJS is in progress [1]. [1]: nginx/njs#698
1 parent 0298301 commit 65871a9

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ $ curl -H 'User-Agent: nessus' -H 'X-Request-ID: 1' 192.168.56.{2,3}
4747
- https://coreruleset.org/
4848
- https://github.com/SpiderLabs/ModSecurity
4949
- https://github.com/SpiderLabs/ModSecurity-nginx
50-
- http://nginx.org/en/download.html
50+
- https://nginx.org/en/download.html
51+
- https://nginx.org/en/docs/njs/
52+
- https://github.com/nginx/njs-examples
53+
- https://nginx.org/en/docs/njs/typescript.html
5154
- https://www.nginx.com/blog/compiling-and-installing-modsecurity-for-open-source-nginx/
5255
- https://www.nginx.com/blog/deploying-nginx-plus-as-an-api-gateway-part-1/
5356
- https://www.nginx.com/resources/wiki/start/topics/examples/logrotation/

roles/nginx/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ nginx_src_directory: "{{ nginx_user_home }}/src"
88

99
nginx_build_configuration:
1010
- --add-module=../../modsecurity-nginx/{{ modsecurity_nginx_version }}
11+
- --add-module=../../njs-nginx/{{ njs_version }}/nginx
1112
- --with-debug
1213
- --with-http_auth_request_module
1314
- --with-http_gzip_static_module

roles/nginx/meta/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
dependencies:
3+
- role: njs
34
- role: owasp_modsecurity_crs

roles/nginx/tasks/main.yml

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- gcc
66
- gcc-c++
77
- libopenssl-1_1-devel
8+
- libxslt-devel
89
- make
910
- patch
1011
- pcre-devel
@@ -21,6 +22,7 @@
2122
- { dest: "{{ nginx_src_directory }}/download" }
2223
- { dest: "{{ nginx_src_directory }}/modsecurity-nginx/{{ modsecurity_nginx_version }}" }
2324
- { dest: "{{ nginx_src_directory }}/nginx/{{ nginx_version }}" }
25+
- { dest: "{{ nginx_src_directory }}/njs-nginx/{{ njs_version }}" }
2426
- { dest: "{{ nginx_user_home }}/.config/systemd/user" }
2527
- { dest: "{{ nginx_user_home }}/etc/logrotate.d/daily.d" }
2628
- { dest: "{{ nginx_user_home }}/etc/nginx/conf.d" }
@@ -70,6 +72,15 @@
7072
- --strip-components=1
7173
mode: u=rwX,g=,o=
7274

75+
- name: Ensure »Nginx njs Module« source is extracted.
76+
ansible.builtin.unarchive:
77+
src: "{{ nginx_src_directory }}/download/njs-v{{ njs_version }}.tar.gz"
78+
dest: "{{ nginx_src_directory }}/njs-nginx/{{ njs_version }}"
79+
remote_src: true
80+
extra_opts:
81+
- --strip-components=1
82+
mode: u=rwX,g=,o=
83+
7384
- name: Get current configuration hash.
7485
ansible.builtin.set_fact:
7586
nginx_build_configuration_hash_current: |-

0 commit comments

Comments
 (0)