# HG changeset patch # User edogawaconan # Date 1414068471 -32400 # Node ID 949398173ecb839524a2f469c1d83c5835891a21 # Parent 431682ff91693ea3c80b9a4e86810b2de4f23178 Much simpler setup with $request_filename. Configuration change, bump version. diff -r 431682ff9169 -r 949398173ecb README.md --- a/README.md Thu Oct 23 21:07:21 2014 +0900 +++ b/README.md Thu Oct 23 21:47:51 2014 +0900 @@ -9,29 +9,34 @@ 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 DL_DIR $dl_dir; fastcgi_param SCRIPT_FILENAME /path/to/index.php; } -(adjust the path to `index.php` and `php-fcgi`) +(adjust the path to `index.php` and `php-fcgi`). -And then whenever you want to autoindex a folder just add +And whenever a directory needs to be autoindexed, 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`). +. + +Note that if the directory is aliased, `$dl_dir` (fastcgi `DL_DIR`) needs to be set. location /anime/win/ { - set $dl_prefix /anime/win; - set $dl_root /srv/ftp; - alias $dl_root/; - try_files $uri @lister; + set $dl_dir $request_filename; + alias /srv/ftp/; + try_files $uri @lister; // try_files "" @lister if the alias is } -And you're done. Probably also works with apache but I have no idea how to setup it. +And done. Probably also works with apache but I have no idea how to set it up. + +Upgrading +--------- + +When upgrading from 1.0.0, update nginx config accordingly. License ------- diff -r 431682ff9169 -r 949398173ecb index.php --- a/index.php Thu Oct 23 21:07:21 2014 +0900 +++ b/index.php Thu Oct 23 21:47:51 2014 +0900 @@ -1,40 +1,34 @@ " . link_to(dirname($prefix . $path) . "/", "[up]") . ""; + if ($uri !== "/") { + $file_rows .= "" . link_to(dirname($uri) . "/", "[up]") . ""; } } foreach($files as $file) { - $file_stat = stat($root . $path . "/". $file); + $file_stat = stat($dir . "/". $file); $file_rows .= ""; $file_rows .= "".link_to($file . $file_suffix, $file . $file_suffix).""; @@ -119,7 +112,7 @@ - Index of <?php echo h($prefix . $path); ?> + Index of <?php echo h($uri); ?>