ngxtop: real-time metrics for nginx server #

ngxtop is shaping up to be one of those tools that I didn’t even know I needed, but now I won’t know how I ever lived without it.

ngxtop parses your nginx access log and outputs useful, top-like, metrics of your nginx server.

Need we say more? Check the readme for some nice examples of what this Python script is capable of.

Nginx gets the boilerplate treatment #

The massive success of the HTML5 boilerplate has inspired similar efforts in other domains. Michael Goreanski has started such an effort for Nginx, the web server employed by many of the Internet’s top sites (recent stats).

Nginx-boilerplate is only a couple months old, but it already boasts configuration templates that feature:

  • A convenient include-based config structure
  • Optimized defaults for caching, gzip’ing, uploads, etc.
  • Connection and requests rate limitation settings
  • Backend response caching
  • Various predefined locations
  • Advanced logging

Boilerplate projects are great because they provide an opportunity for the community to rally around best practices and put them all in one place. The nginx-boilerplate already has a handful of contributors, but I’d love to see that list explode in the coming weeks.

The project is MIT licensed and hosted on GitHub.

nginxparser: A Python module that loads and dumps Nginx configs #

Even tiny, single-use open source tools are worthy of our attention. If you have the need to programmatically configure your Nginx servers, look no further than nginxparser by Fatih Erikli.

Weighing in at less than 100 lines of code, nginxparser provides two features.

loading:

from nginxparser import load
load(open("/etc/nginx/sites-enabled/foo.conf"))

    [['server'], [
        ['listen', '80'],
        ['server_name', 'foo.com'],
        ['root', '/home/ubuntu/sites/foo/']]]]

and dumping:

from nginxparser import dumps
dumps([['server'], [
    ['listen', '80'],
    ['server_name', 'foo.com'],
    ['root', '/home/ubuntu/sites/foo/']]])

    'server {
        listen   80;
        server_name foo.com;
        root /home/ubuntu/sites/foo/;
    }'    

I was impressed with how simple it is to define a parser using Pyparsing, which nginxparser does to great effect.

It’s definitely worth checking out!

Nginx gains support for WebSockets #

I saw this commit land a few days ago, and now it’s out in a release. nginx 1.3.13 has support for proxying WebSockets requests.

What does that mean? Well, let’s look at the commit that introduced the change:

This allows to proxy WebSockets? by using configuration like this:

location /chat/ {

    proxy_pass ​http://backend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

}

A nice example, right there! Before you could do this, you needed to do some kind of extra tricks, like using varnish in front of nginx and having varnish proxy the requests straight to your back end servers. Super awkward.

You can grab a copy of nginx 1.3.13 on their download page.

Discuss on Hacker News.

super-nginx: nginix on steroids serves up async Lua apps #

Ezra Zygmuntowicz, Engine Yard founder now at VMWare, has released a “killer build of nginx” that bundles seventeen popular nginx modules as well as Luajit, a just-in-time compiler for Lua.

Logo

Super-nginx bundles the following popular modules:

A nice complement to the built-in Redis and Drizzle support from the list above, Ezra has also included his own script to build Luajit, which allows you to use nginx as an evented Lua web server in the style of EventMachine or Node.js.

[Source on GitHub]