Nginx 和 Apache 开启目录浏览功能

Posted Meadows of Heaven

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx 和 Apache 开启目录浏览功能相关的知识,希望对你有一定的参考价值。

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目录浏览功能

 

以上是关于Nginx 和 Apache 开启目录浏览功能的主要内容,如果未能解决你的问题,请参考以下文章

apache开启和关闭目录浏览权限

nginx配置反向代理缓存负载均衡

开启nginx目录文件列表显示功能

如何开启apache虚拟目录反向代理

关闭或者开启apache的目录浏览

如何让nginx实现手机能访问本地代码的功能