您的位置:首页 > 运维架构 > Nginx

Nginx 和 Apache 开启目录浏览功能

2016-03-12 14:12 801 查看
1.Nginx

在相应项目的 Server 段中的 location 段中,添加 autoindex on。例如:

server
{
listen 80;
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:9000;
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=25 Charset=UTF-8
Allow from all
</Directory>




<Directory />"d:/wamp/www/practise"
#开启目录列表索引模式
Options Indexes
Order allow,deny
IndexOptions NameWidth=25 Charset=UTF-8
Allow from all
</Directory>


参考:

启用apache目录浏览功能
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: