1
|
1 Better Autoindex with nginx/php
|
|
2 ===============================
|
|
3
|
|
4 Using capability of nginx.
|
|
5
|
|
6 Basically, add this block
|
|
7
|
|
8 location @lister {
|
|
9 fastcgi_pass unix:/tmp/php-fcgi.sock;
|
|
10 fastcgi_param PREFIX $_list_prefix;
|
|
11 fastcgi_param FILE_ROOT $_list_root;
|
|
12 fastcgi_param SCRIPT_FILENAME /srv/http/index.php;
|
|
13 include fastcgi_params;
|
|
14 }
|
|
15
|
|
16 (adjust the path to `lister.php` and `php-fcgi`)
|
|
17
|
|
18 And then whenever you want to autoindex a folder just add
|
|
19
|
|
20 location /anime/win/ {
|
|
21 set $_list_prefix /anime/win;
|
|
22 set $_list_root /srv/ftp;
|
|
23 alias $_list_root/;
|
|
24 try_files $uri @lister;
|
|
25 }
|
|
26
|
|
27 And you're done.
|
|
28
|
|
29 The code needs some cleanups though.
|