1. 准备工作

如果是全新安装,需要准备Nginx 源文件和 PCRE 库

sudo apt-cache search pcre

sudo apt-get install libpcre3-dev

2. 安装 git

sudo apt-get install git

3. 下载并安装 FancyIndex

cd /usr/local/src

git clone git://gitorious.org/ngx-fancyindex/ngx-fancyindex.git ngx-fancyindex

查看当前 Nginx 版本

sudo nginx -v

./configure –add-module=../ngx-fancyindex  [extra desired options]

make && make install

4. 修改 Nginx 虚拟主机配置文件

nano /etc/nginx/sites-available/default

location / {
fancyindex on;              # Enable fancy indexes.
fancyindex_exact_size off;  # Output human-readable file sizes.
}