Nginx has announced nginScript, a custom JavaScript implementation used to enable dynamic configuration and delivery within the web server. At this year's nginx.conf, nginx creator Igor Sysoev took to the stage to demonstrate the new feature.

Nginx already supports Lua for script-based configuration, but nginScript lowers the barrier of entry to those who already have a background in JavaScript. Rather than relying on an existing virtual machine, execution of the language is handled by a custom VM, purpose built for the requirements of nginx.

In use, nginScript allows the result of a JavaScript snippet to be used for configuration. In a blog post accompanying the announcement, Sysoev showcased a few possibilities. For example:

http { js_set $hello_world " var str = 'Hello World!'; // JavaScript str; "; server { ... location /{ return 200 $hello_world; } } }

In this example, the result of the snippet is stored in a variable $hello_world , which is then used as the response to a web request at a specific route. While it's possible to use nginScript to serve up an entire JavaScript-based web application, that's not the intent. The new language is a subset of JavaScript, so existing modules made for environments like node.js likely will not work. The nginScript documentation spells this out specifically:

We don’t plan to create an alternative to node.js, or any other application platforms. nginScript is targeted very firmly at extending the NGINX configuration to give you more control over HTTP traffic.

Over on Hacker News, reaction was mixed. User eknkc was encouraged:

I think it's a good addition. We have been using varnish on high traffic servers and one of the reasons was that it had "vcl", a JavaScript-like language to define request handling logic. Having JavaScript on nginx would provide a lot of config options for people familiar with it.

But others are cautiously optimistic. User CrLf said:

The usefulness of this is not to turn nginx into an application server. The point is to make nginx's configuration dynamic and prevent bloating applications with stuff that belongs at the (lets call it) devops level.

Nginx says they don't intend for nginScript to replace Lua, but given the pervasiveness of JavaScript in the community, it wouldn't be a surprise to see JavaScript overtake Lua in usage. For now, nginScript is available for testing and feedback in the mecurial repository.