官方文档地址:
http://wiki.nginx.org/NginxHttpAutoindexModule
[root@slave ~]# wget
http://download.snake.de/dist/ngx-fancyindex-0.2.1.tar.bz2
[root@slave ~]# tar jxvf ngx-fancyindex-0.2.1.tar.bz2
[root@slave nginx-0.7.65]# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --add-module=/root/ngx-fancyindex-0.2.1
[root@slave nginx-0.7.65]# make && make install
然后根据自己的目录浏览要求配置 nginx.conf ,以下为我的主机配置
server {
listen 80;
server_name 192.168.11.12;
location / {
fancyindex on;#开启 fancy indexes
fancyindex_exact_size off;#显示文件大小。
# autoindex on;
#autoindex_localtime on;
#autoindex_exact_size off; 注释这三项是不装插件开启目录浏览功能。
root /data ;
}
}