roryrjb / ngx-uname

Nginx module exposing uname as JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Nginx module exposing uname as JSON

License:MIT License


Languages

Language:C 61.0%Language:Shell 26.0%Language:Dockerfile 9.5%Language:Makefile 3.5%