Web 目录文件浏览配置


IIS 配置目录浏览

在目录下 Web.config 下添加一句:

<directoryBrowse enabled="true"/>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".apk" mimeType="text/plain" />
        staticContent>
        
    system.webServer>
configuration>


Nginx 配置目录浏览

默认是禁止目录浏览的

http {  
    autoindex on;   #开启nginx目录浏览功能
    autoindex_exact_size off;  #文件大小从KB开始显示
    autoindex_localtime on;  #显示文件修改时间为服务器本地时间

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       9091;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        } 
    } 
}