zoukankan      html  css  js  c++  java
  • nginx设置目录浏览及解决中文乱码问题

    在Nginx下默认是不允许列出整个目录的。
    如需开启此功能,先打开nginx.conf文件,在location server 或 http段中加入相关参数。

    http
        {
            include         mime.type;
            default_type    application/octet-stream;
            autoindex       on;
            autoindex_exact_size    off;
            autoindex_localtime     on;
            charset         utf-8,gbk;
    
            server_names_hash_bucket_size   128;
            client_header_buffer_size       32k;
            large_client_header_buffers     4 32k;
            client_max_body_size            50m;
    

    参数解释:

    autoindex_exact_size off;
    默认为on,显示出文件的确切大小,单位是bytes。
    改为off后,显示出文件的大概大小,单位是kB或者MB或者GB

    autoindex_localtime on;
    默认为off,显示的文件时间为GMT时间。
    注意:改为on后,显示的文件时间为文件的服务器时间

    但是如果有中文目录的话会出现乱码问题,所以还需要在下面添加这一句:
    charset utf-8,gbk;

    [THE END]

  • 相关阅读:
    Daily Scrum 12.16
    Daily Scrum 12.15
    Daily Scrum 12.14
    Daily Scrum 12.12
    Daily Scrum 12.11
    Pipeline组Beta版本发布说明
    Pipeline组项目Postmortem
    Pipeline组Alpha版本发布说明
    Pipeline组测试说明
    Daily Scrum 11.6
  • 原文地址:https://www.cnblogs.com/configure/p/8629193.html
Copyright © 2011-2022 走看看