Nginx参考手册
指南 | Guides
About nginScript
- 目前支持什么
- 什么不支持呢
- 下载并安装
- 作为Linux软件包进行安装
- 从源头上构建
nginScript是JavaScript语言的一个子集,它允许在http和stream中实现位置和变量处理程序。nginScript是根据ECMAScript 5.1和一些ECMAScript 6扩展创建的。合规性仍在不断发展。
目前支持什么
- 布尔值,数字,字符串,对象,数组,函数和正则表达式
- ES5.1操作符,ES7指数操作符
- ES5.1声明:
var,if,else,switch,for,for in,while,do while,break,continue,return,try,catch,throw,finally - ES6
Number和Math属性和方法 -
String方法:- ES5.1: ,
fromCharCode,concat,slice,substring,substr,charAt,charCodeAt,indexOf,lastIndexOf,toLowerCase,toUpperCase,trim,search,,matchsplitreplace - ES6: ,
fromCodePoint,codePointAt,includes,,startsWithendsWithrepeat - 非标:
fromUTF8,toUTF8,fromBytes,toBytes
- ES5.1: ,
-
Object方法:- ES5.1:
create(无属性列表的支持), ,keys,defineProperty,defineProperties,getOwnPropertyDescriptor,getPrototypeOf,hasOwnProperty,isPrototypeOf,preventExtensions,isExtensible,freeze,,isFrozensealisSealed
- ES5.1:
-
Array方法:- ES5.1: ,
isArray,slice,splice,push,pop,unshift,shift,reverse,sort,join,concat,indexOf,lastIndexOf,forEach,some,every,filter,,mapreducereduceRight - ES6: ,
of,,fillfindfindIndex - ES7:
includes
- ES5.1: ,
- ES5.1
Function方法:call,apply,bind - ES5.1
RegExp方法:test,exec - ES5.1
Date方法 - ES5.1全局函数:
isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent
什么不支持呢
- ES6
let和const声明 - 标签
-
arguments排列 -
eval功能 -
JSON目的 -
Error目的 -
setTimeout,setInterval,setImmediate功能 - 非整数分数(
.235),二进制(0b0101),八进制(0o77)文字
下载与安装
nginScript有两个模块可用:
- ngx_http_js_module
- ngx_stream_js_module
这两个模块都不是默认生成的,它们应该从源代码编译或作为Linux软件包安装。
作为Linux软件包进行安装
对于Linux,可以使用nginScript模块包:
-
nginx-module-njs- nginScript动态模块 -
nginx-module-njs-dbg- 调试nginx-module-njs包的符号
从源头上构建
可以使用以下命令复制具有nginScript源的存储库:(需要Mercurial客户端):
hg clone http://hg.nginx.org/njs
然后,模块应该使用--add-module配置参数进行编译:
./configure --add-module=path-to-njs/nginx
这些模块也可以构建为动态:
./configure --add-dynamic-module=path-to-njs/nginx
指南 | Guides相关
Nginx是一款轻量级的 Web 服务器/反向代理服务器及电子邮件代理服务器,可在 BSD-like 协议下发行。其特点是占有内存少,并发能力强。
| 主页 | https://nginx.org/ |
| 源码 | http://hg.nginx.org/nginx |
| 发布版本 | 1.13.6 |
加载中,请稍侯......