You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+70Lines changed: 70 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,16 @@ Note: the examples below work with njs >= `0.7.0 <http://nginx.org/en/docs/njs/c
14
14
15
15
Running inside Docker
16
16
---------------------
17
+
Public nginx docker image contains open source version of nginx. To run examples for NGINX-PLUS, you have to `build <https://www.nginx.com/blog/deploying-nginx-nginx-plus-docker/>`_ your own docker image.
.. note:: The `keyval <http://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval>`_ and `keyval_zone <http://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval_zone>`_ directives are available as part of our `commercial subscription <https://www.nginx.com/products/nginx/>`_.
1106
+
1107
+
In this example `keyval <http://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval>`_ is used to count (accross all nginx workers) the incoming requests from the same ip address.
1108
+
1109
+
nginx.conf:
1110
+
1111
+
.. code-block:: nginx
1112
+
1113
+
...
1114
+
1115
+
http {
1116
+
js_path "/etc/nginx/njs/";
1117
+
1118
+
js_import main from http/logging/num_requests.js;
1119
+
1120
+
js_set $num_requests http.num_requests;
1121
+
1122
+
keyval_zone zone=foo:10m;
1123
+
1124
+
keyval $remote_addr $foo zone=foo;
1125
+
1126
+
log_format bar '$remote_addr [$time_local] $num_requests';
0 commit comments