view README.md @ 3:9ea8be5b28d1

"refactor".
author edogawaconan <me@myconan.net>
date Tue, 21 Oct 2014 18:01:43 +0900
parents 9ba6983b7c19
children 47a281c1d54e
line wrap: on
line source

Better Autoindex with nginx/php
===============================

Using capability of nginx.

Basically, add this block

    location @lister {
      fastcgi_pass unix:/tmp/php-fcgi.sock;
      fastcgi_param PREFIX $_list_prefix;
      fastcgi_param FILE_ROOT $_list_root;
      fastcgi_param SCRIPT_FILENAME /srv/http/index.php;
      include fastcgi_params;
    }

(adjust the path to `lister.php` and `php-fcgi`)

And then whenever you want to autoindex a folder just add

    location /anime/win/ {
      set $_list_prefix /anime/win;
      set $_list_root /srv/ftp;
      alias $_list_root/;
      try_files $uri @lister;
    }

And you're done.

The code needs some cleanups though.