Nginx Open Directory browsing function (AutoIndex)

Source: Internet
Author: User

Nginx default is not allowed to list the entire directory. For this feature, open the nginx.conf file or you want to enable directory browsing virtual host configuration file, add AutoIndex on to the server or location segment, and enable directory traffic, as described below.

In addition Nginx directory traffic has two more useful parameters, can be added according to their own needs:

Autoindex_exact_size off;
The default is on to show the exact size of the file, in bytes.
After change to off, the approximate size of the file is displayed, in kilobytes or MB or GB

Autoindex_localtime on;
The default is off, and the file time displayed is GMT time.
When on, the file time displayed is the server time of the file

1, the entire virtual host to open directory traffic

Add in Server segment

Location/{
AutoIndex on;
Autoindex_localtime on; #之类的参数写这里
}

2. Open Directory traffic in a separate directory
2.1: Direct two-level directory to open Directory traffic
location/down/{
AutoIndex on;
}

2.2: Virtual directory to open Directory traffic
location/down/{
alias/home/wwwroot/lnmp/test/;
AutoIndex on;
}

Detailed reference: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html

If you want to make a beautiful directory listing, support Header,footer can install the three-party plugin:
Http://wiki.nginx.org/NginxNgxFancyIndex

Restart the nginx to make it effective.


This article is from the "Smurf Linux ops" blog, so be sure to keep this source http://jin771998569.blog.51cto.com/2147853/1670327

Nginx Open Directory browsing function (AutoIndex)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.