njs 是可以 javascrip 编写 nginx 处理逻辑。 njs 可以通过编译成 dynamic module 添加到 nginx/openresty ; 编译的过程: 到 http://hg.nginx.org/njs 下载 njs 代码; 进入 nginx/openrety 的源码目录 ./configurate --add-dynamical-module=/xxxx/njs_root_path/nginx ,参数为 njs 源码目录下的 nginx 目录的绝对路径 在 nginx/openresty 源码根路径下执行 make 第4步执行完后, 执行 make install 在 nginx.conf 下配置 njs 动态模块; nginx.conf worker_processes 1; load_module /usr/local/openresty/nginx/modules/ngx_http_js_module.so; # openrety 默认路径 events { worker_connections 1024; } http { js_include http.js; server { listen 80; error_log /usr/local/openresty/nginx/logs/e.log; location / { js_content foo; } } } /usr/local/openresty/nginx/conf/http.

Continue reading

Author's picture

Matt

My Blog

Nil

China