nginx

nginx默认不允许列出文件目录,需要开启; 开启后只需删除掉index.html文件,因为找不到index.html才会列出当前目录文件;

   server {
        autoindex on;
        autoindex_exact_size off;
        listen       80;
        server_name  localhost;
        location /pub {
            root   html;
            index  index.html index.htm;
        }
    }

apache

需要在httpd.conf中增加以下设置,另外关闭selinux,iptables服务

Alias /pub /home/ftp/pub/
<Directory “/home/ftp/pub”>
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>