diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-11-29 14:29:45 +0100 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-11-29 14:29:45 +0100 |
| commit | 8846dca97777ea3322c984b69c79a9a2fd4f75cd (patch) | |
| tree | 2bc498d8c0c43a0bb14cde9c2fbf62688c2d5fee | |
| parent | cd9b58da9e6b31bf780688b2a162f4c3f28ba4c2 (diff) | |
| download | site-8846dca97777ea3322c984b69c79a9a2fd4f75cd.tar.gz | |
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 ]
| -rw-r--r-- | etc/nginx.conf | 4 |
1 files changed, 4 insertions, 0 deletions
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 { | |||
| 24 | # Downloads and attachments. | 24 | # Downloads and attachments. |
| 25 | # | 25 | # |
| 26 | location ^~ /download/ { | 26 | location ^~ /download/ { |
| 27 | if ($args = $is_args) { | ||
| 28 | # Fancy Index: Sort by modification time (descending). | ||
| 29 | rewrite ^(.*/)$ $1?C=M&O=D last; | ||
| 30 | } | ||
| 27 | root /home/plugins/web; | 31 | root /home/plugins/web; |
| 28 | fancyindex on; | 32 | fancyindex on; |
| 29 | fancyindex_exact_size off; | 33 | fancyindex_exact_size off; |
