Home  >  Article  >  Operation and Maintenance  >  How to enable Nginx directory browsing function

How to enable Nginx directory browsing function

王林
王林forward
2023-05-14 13:46:061427browse

We all know that under apache, you can configure a certain path to access the web server to automatically display the file list under the directory. In fact, nginx is not weaker than apache at all. Of course, it can also implement this function, and it is very easy. and simple; mainly use the autoindex parameter to enable it, and its configuration is as follows:

Copy code The code is as follows:

location / {
           root /data/www/file                                   /Specify the absolute path to the actual directory;
autoindex on; autoindex_localtime on;                                                                                                                                           ​​​​​​​​​​​​​​​​​​ // Turn on the server's local time zone to display the file modification date!
}

After the above configuration, use IE to access the root directory of the server, and a list of all files in the /data/www/file directory will be displayed. The nginx directory browsing rendering is:

How to enable Nginx directory browsing function








######### Also record the configuration method under apache! The effect is the same as above! #########Copy code The code is as follows:######alias / ”/data/www/file” ###                                                                                Indexes // Open the directory list index mode ### Order Allow, DENY ### Indexoptions namewidth = 25 charset = UTF -8 // Set file name display length, text character encoding ### all all ### & lt; /directory >###

The above is the detailed content of How to enable Nginx directory browsing function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete