nginx module for displaying uname as JSON
dynamic module support

refs

master
browse log

clone

read-only
https://git.sr.ht/~roryrjb/ngx-uname
read/write
git@git.sr.ht:~roryrjb/ngx-uname

ngx-uname

Nginx module for displaying uname as JSON (Linux only).

Installation

Firstly clone this repo somewhere.

Download Nginx source:

$ wget https://nginx.org/download/nginx-VERSION.tar.gz
$ tar -xzf nginx-VERSION.tar.gz
$ cd nginx-VERSION

Build as static module:

$ ./configure --add-module=/path/to/ngx-uname
$ make
$ sudo make install

Build as a dynamic module:


Usage

Specify a location in your Nginx configuration to display the data, which will be output as JSON (application/json):

location /uname {
  uname;
}

Example output:

{
  "sysname": "Linux",
  "nodename": "my-awesome-server",
  "release": "4.4.0-72-generic",
  "version": "#93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017",
  "machine": "x86_64"
}

Testing

There's an included Dockerfile that will build this module against various versions of Nginx and do a simple curl test against an endpoint.

$ make test