Welcome! Log In Create A New Profile

Advanced

Re: Nginx Directory Autoindex

Roman Arutyunyan
March 01, 2018 11:46AM
Hi,

On Thu, Mar 01, 2018 at 05:27:49PM +0100, Luciano Mannucci wrote:
> On Thu, 1 Mar 2018 12:16:34 +0000
> Miguel C <miguelmclara@gmail.com> wrote:
>
> > there's a default sorting option for name/data etc
> > https://github.com/aperezdc/ngx-fancyindex#fancyindex-default-sort
> >
> > I do see a default_sort as a directive but not for "ascending" "descending"
> > (doesn't since supper hard to implement in the code though, but I'm not a C
> > expert....
> Yes, it sould'nt be that hard... :)
>
> > Vladimir Homutov just suggested a different approach with the autoindex
> > module and xslt that seems to serve you're need, and that way there's no
> > need to install a 3rd party moduel :)
> I'm not comfortable with XML/XSLT, so I just made a small hack to the
> original autoindex that is quite enough for me (=works and made my
> users happy :).
>
> If there is some interest I can post my patch to the apropriate list
> (nginx devel, if I recall correctly :).

Just in case you'll get back to XML/XSLT, here's a simple configuration to
sort the files:

location / {
autoindex on;
autoindex_format xml;
xslt_stylesheet conf/sort.xslt;
root html;
}


sort.xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<table border="1">
<xsl:for-each select="list/*">
<xsl:sort select="text()"/>
<tr>
<td><xsl:value-of select="text()"/></td>
<td><xsl:value-of select="@mtime"/></td>
<td><xsl:value-of select="@size"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

--
Roman Arutyunyan
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx Directory Autoindex

Luciano Mannucci February 28, 2018 01:04PM

Re: Nginx Directory Autoindex

mike-pt February 28, 2018 06:32PM

Re: Nginx Directory Autoindex

Luciano Mannucci March 01, 2018 06:56AM

Re: Nginx Directory Autoindex

mike-pt March 01, 2018 07:18AM

Re: Nginx Directory Autoindex

Luciano Mannucci March 01, 2018 11:30AM

Re: Nginx Directory Autoindex

Roman Arutyunyan March 01, 2018 11:46AM

Re: Nginx Directory Autoindex

Luciano Mannucci March 01, 2018 12:32PM

Re: Nginx Directory Autoindex

James March 02, 2018 05:36AM

Re: Nginx Directory Autoindex

Luciano Mannucci March 02, 2018 06:36AM

Re: Nginx Directory Autoindex

James March 02, 2018 09:06AM

Re: Nginx Directory Autoindex

Vladimir Homutov March 02, 2018 09:18AM

Re: Nginx Directory Autoindex

James March 02, 2018 09:30AM

Re: Nginx Directory Autoindex

Vladimir Homutov March 01, 2018 07:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready