view README.md @ 61:72580314dd6a default tip

Update source url
author nanaya <me@nanaya.pro>
date Sat, 23 Feb 2019 02:42:40 +0900
parents 25e3119e91b2
children
line wrap: on
line source

dirlist
=======

Using capability of nginx.

Usage
-----

### nginx

    location @lister {
      include fastcgi_params;
      fastcgi_pass unix:/tmp/php-fcgi.sock;

      // BEGIN -- only when using alias
      uninitialized_variable_warn off;
      fastcgi_param DL_DIR $dl_dir;
      // END ---- only when using alias

      fastcgi_param SCRIPT_FILENAME /path/to/index.php;
    }

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

And whenever a directory needs to be autoindexed, add

    location / {
      try_files $uri @lister;
    }

.

Note that if the directory is aliased, `$dl_dir` (fastcgi `DL_DIR`) needs to be set.

    location /anime/win/ {
      set $dl_dir $request_filename;
      alias /srv/ftp/;
      try_files $uri @lister; // try_files "" @lister if the alias is in a regular expression location.
    }

### apache

Assuming `mod_rewrite` is enabled, add this `.htaccess`:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ /path/to/index.php [L]

Note that `/path/to/index.php` should be visible from your location. Or something. I don't really know Apache.

Also note that this `.htaccess` does not disable server processing of `php` or any other non-static files.

Configurations
--------------

Here are some variables which changes how it behaves:

- `DL_DIR`: sets directory to be listed.
- `DL_SHOWALL`: show or hide files which name start with `.`. Set to `1` to show.

Upgrading
---------

When upgrading from 1.0.0, update nginx config accordingly.

Bugs
----

Windows edition of PHP can't handle unicode filename and thus doesn't really work in Windows if you have non-ASCII files.

License
-------

    Copyright 2014 edogawaconan <me@myconan.net>

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted, provided that the above
    copyright notice and this permission notice appear in all copies.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.