Home > Operation and Maintenance > Nginx > How to enable nginx directory listing

How to enable nginx directory listing

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-05-14 11:55:13
forward
1137 people have browsed it

nginx opens the column directory

When you want nginx to exist as a file download server, you need to open the nginx column directory

server {     location download {         autoindex on;          autoindex_exact_size off;         autoindex_localtime on;     } }
Copy after login

autoindex_exact_size: is on (default) When it is off, it displays the exact size of the file, the unit is byte; when it is changed to off, it displays the approximate size of the file, the unit is KB or MB or GB

autoindex_localtime: when it is off (default), the file time displayed is GMT time; when it is changed on After that, the file time displayed is the server time

By default, when accessing the listed txt and other files, the content of the file will be displayed on the browser. If you want the browser to download it directly, add the configuration below

if ($request_filename ~* ^.*?\.(txt|pdf|jpg|png)$) {     add_header Content-Disposition 'attachment'; }
Copy after login

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

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template