view README.md @ 10:47a281c1d54e

Update documentation to match current code.
author edogawaconan <me@myconan.net>
date Tue, 21 Oct 2014 22:07:03 +0900
parents 9ba6983b7c19
children 37fad414ac29
line wrap: on
line source

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

Using capability of nginx.

Basically, add this block

    location @lister {
      include fastcgi_params;
      fastcgi_pass unix:/tmp/php-fcgi.sock;
      uninitialized_variable_warn off;
      fastcgi_param DL_PREFIX $dl_root;
      fastcgi_param DL_ROOT $dl_prefix;
      fastcgi_param SCRIPT_FILENAME /path/to/index.php;
    }

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

And then whenever you want to autoindex a folder just add

    location / {
      try_files $uri @lister;
    }

Note that if your directory is aliased, you need to set `$dl_prefix` (fastcgi `DL_PREFIX`) and `$dl_root` (fastcgi `DL_ROOT`).

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

And you're done.