Rafa_F
February 26, 2016, 8:28pm
1
Hi,
The documentation said it’s possible to transform XML dirlistings into
XHTML in order to customize what they look like, so I did one that makes
them look like lighttpd’s:
dirlist.xslt
<?xml version="1.0"?>
<!--
dirlist.xslt - transform nginx's into lighttpd look-alike dirlistings
I'm currently switching over completely from lighttpd to nginx. If you come
up with a prettier stylesheet or other improvements, please tell me :)
-->
<!--
Copyright (c) 2016 by Moritz Wilhelmy <[email protected] >
This file has been truncated. show original
nginx-snippet.conf
server {
...
root /opt/www;
location / {
try_files $uri @autoindex;
}
location @autoindex {
This file has been truncated. show original
This works fine, but does anybody know how I apply the XSLT only
to transform directory indexes but not other XML files that might be
around? Currently, the way this config works is that all XML files are
being transformed by this stylesheet.
The config looks like this:
dirlist.xslt
<?xml version="1.0"?>
<!--
dirlist.xslt - transform nginx's into lighttpd look-alike dirlistings
I'm currently switching over completely from lighttpd to nginx. If you come
up with a prettier stylesheet or other improvements, please tell me :)
-->
<!--
Copyright (c) 2016 by Moritz Wilhelmy <[email protected] >
This file has been truncated. show original
nginx-snippet.conf
server {
...
root /opt/www;
location / {
try_files $uri @autoindex;
}
location @autoindex {
This file has been truncated. show original
Thanks and best regards,
Moritz
to transform directory indexes but not other XML files that might be
around? Currently, the way this config works is that all XML files are
being transformed by this stylesheet.
The config looks like this:
make nginx dirlistings look like lighttpd's through the magic of xslt-transforming xml dirlistings. I don't even. · GitHub
Cannot check with xslt right now, but autoindex should works with this
setup:
root /opt/www;
location / {
try_files $uri @autoindex;
}
location @autoindex {
autoindex on;
}
Try to add xslt and xml directives in @autoindex location.
On Fri, Feb 26, 2016 at 23:22:54 +0300, Sergey B. wrote:
This works fine, but does anybody know how I apply the XSLT only
root /opt/www;
location / {
try_files $uri @autoindex;
}
location @autoindex {
autoindex on;
}
Try to add xslt and xml directives in @autoindex location.
Thanks, that seems to have done the trick. I’ve updated the gist to
reflect my current working config, for anyone who’s curious.
Best regards,
Moritz
16c999e8c71134401a78d4d46435517b2271d6ac
mojombo@16c999e8c71134401a78d4d46435517b2271d6ac
mojombo/github-flavored-markdown@16c999e8c71134401a78d4d46435517b2271d6ac
Posted at Nginx Forum:
Hi, The documentation said it's possible to transform XML dirlistings into XHTML in order to customize what they look like, so I did one that makes them look like lighttpd's: https://gist.github.com/wilhelmy/5a59b8eea26974a468c9 This works fine, but...