Monthly Archives: June 2014

Understanding Nginx location rules

Ningx is slim and the configuration feels in many respects less bloated than Apache. But it’s also a little idiosyncratic, and the official documentation, still, is not great. I keep forgetting about the location rules, so here’s an attempt to make my own cheatsheet.

A location block applies some configuraton by matching against a request URI. A location can be one of these five types:

 nginx

(The official documentation, among other things, calls “prefix” the type identifier string ( =,^*,~,~*); this can be confusing, because we are also speaking (in cases 2.a 2.b) of “prefix matching” …)

Important: among the list of location blocks inside a server, only one will be picked (or none). The only way to “compose” settings is by using nested locations.

Trying syntax higlighters…

I’m testing several of the many syntax higlighter plugins for posting code in WordPress… This is a nice list. All are impressive, but after trying the first five, I’m liking most Crayon Syntax Highlighter. I love the extensive customization (including styles, like font sizes); on the minus side, the docs are rather caothic with (currently) many broken links and images. Another slight objection could be that it formats (by default) all <pre> elements.