Modified in master configuration file httpd.conf:
1) Add support module.
LoadModule Autoindex_module modules/mod_autoindex.so
LoadModule Dir_module modules/mod_dir.so
Note Be sure to have these two modules, otherwise the following configuration does not take effect, return 404 Not Found error.
This module may also be compiled directly into the Apache core file httpd.
2 Add options Indexes to the DocumentRoot directory to generate the catalog.
<directory "/htdocs" >
Options Indexes FollowSymLinks
</Directory>
Here indexes control whether to open Directory browsing, if you want to close directory browsing, use
Option-indexes
3) Load httpd-autoindex.conf configuration
Include conf/extra/httpd-autoindex.conf
Example
Add the following code to the http.conf (if there is a virtual host configuration, load into the virtual host configuration segment)
1 alias/dist "I:/build/dist"
2 <directory "I:/build/dist" >
3 #开启目录列表索引模式
4 Options Indexes
5 Order Allow,deny
6 Indexoptions namewidth=25 Charset=utf-8
7 Allow from all
8 </Directory>
where "I:/build/dist" is the directory to display a list of files, the parameter "Options Indexes" means to enable directory browsing, "Indexoptions Charset=utf-8" set the character set to eliminate Chinese garbled, namewidth=50 : Specifies that the directory list can display a file/directory name that is up to 25 bytes long.