Methods to enable Nginx directory browsing _nginx

Source: Internet
Author: User
Tags local time

Today's job needs, to provide customers with a patch download address, so want to use the Nginx directory browsing function to do, need to let the customer see a directory to specify a list of files, and then let him choose to download that file;

We all know that under Apache can be configured to access a path to the Web server, automatically display the list of files below its directory, in fact, Nginx is not as weak as Apache, it can certainly achieve this function, but also very easy and simple; mainly used to AutoIndex This parameter is turned on and is configured as follows:

Copy Code code as follows:
Location/{
Root/data/www/file//Specify an absolute path to the actual directory;
AutoIndex on; Open Directory browsing function;
Autoindex_exact_size off; Close the detailed file size statistics, let the file size display MB,GB units, the default is B;
Autoindex_localtime on; Open to display file modification date in server local time zone!
}

When configured, use IE to access the server's root directory, it will show the/data/www/file directory of all Files list, Nginx directory browsing effect map:

In order to remember, and finally the Apache configuration method also recorded! Achieve the same effect as above!

Copy Code code as follows:
Alias/"/data/www/file"
< Directory "/data/www/file" >
Options Indexes//Open Directory list indexing mode
Order Allow,deny
Indexoptions namewidth = Charset = UTF-8//set filename display length, literal character encoding
Allow from all
</Directory >

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.