Open the nginx. conf file and add it to the location server or http segment.
| The code is as follows: |
Copy code |
Autoindex on; |
We recommend that you add the following two parameters:
| The code is as follows: |
Copy code |
Autoindex_exact_size off; |
The default value is on. The exact size of the file is displayed, in bytes.
After changing to off, the approximate size of the file is displayed. The unit is kB, MB, or GB.
| The code is as follows: |
Copy code |
Autoindex_localtime on; |
The default value is off. The displayed file Time Is GMT.
After changing to on, the displayed File time is the file server time
| The code is as follows: |
Copy code |
Location /{ Root/var/www/html; Autoindex on; } |
This code directly lists the/var/www/html directory as the root directory.
If we want to display only one website or one directory, it is very easy to modify all the. conf files of the website. Modify it as follows:
| The code is as follows: |
Copy code |
Server { Listen 80; Charset UTF-8; Server_name localhost; Root/www/web/default; Location /{ Autoindex on; Autoindex_exact_size off; Autoindex_localtime on; } } |