Nginx 和 Apache 开启目录浏览功能
1.Nginx
在相应项目的 Server 段中的 location 段中,添加 autoindex on。例如:
server
{
listen ;
server_name www.dee.practise.com;
location /{
root html/practise;
#index index.php;
autoindex on;
}
location ~ \.php$ {
#root html;
root html/practise;
#fastcgi_pass 127.0.0.1:;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
access_log /home/wwwlogs/practise/access.log access;
}2.Apache
在 http.conf 中加入如下代码(以 d:/wamp/www/practise 目录为例):
<Directory "d:/wamp/www/practise"> #开启目录列表索引模式 Options Indexes Order allow,deny IndexOptions NameWidth= Charset=UTF- Allow from all </Directory>
或
<Directory />"d:/wamp/www/practise" #开启目录列表索引模式 Options Indexes Order allow,deny IndexOptions NameWidth= Charset=UTF- Allow from all </Directory>
参考: