From 8846dca97777ea3322c984b69c79a9a2fd4f75cd Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Fri, 29 Nov 2013 14:29:45 +0100 Subject: Nginx: Sort /download/ files by modification time Append "?C=M&O=D" to /download/ URLs: /* * Determine the sorting criteria. URL arguments look like: * * C=x[&O=y] * * Where x={M,S,N} and y={A,D} */ [ https://github.com/aperezdc/ngx-fancyindex/blob/master/ngx_http_fancyindex_module.c ] diff --git a/etc/nginx.conf b/etc/nginx.conf index ba24971..25eda96 100644 --- a/etc/nginx.conf +++ b/etc/nginx.conf @@ -24,6 +24,10 @@ server { # Downloads and attachments. # location ^~ /download/ { + if ($args = $is_args) { + # Fancy Index: Sort by modification time (descending). + rewrite ^(.*/)$ $1?C=M&O=D last; + } root /home/plugins/web; fancyindex on; fancyindex_exact_size off; -- cgit v0.10-9-g596f