nginx配置可查看目录文件

server {
    listen       8111;
    server_name  localhost;

    location / {
        root   /root/jarServer;
        try_files $uri $uri/ /index.html;
        index  index.html;
            autoindex on;  # 开启目录文件列表
            autoindex_exact_size on;  # 显示出文件的确切大小,单位是bytes
            autoindex_localtime on;  # 显示的文件时间为文件的服务器时间
            charset utf-8,gbk;  # 避免中文乱码
    }
}

正常打开目录会显示403禁止访问 在nginx配置文件里面修改下nginx.conf即可,格式如上。
NGINXCONF.png

Last modification:July 27th, 2019 at 09:18 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment