修改 nginx.conf 文件,添加配置和 server:
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
server {
listen 8080;
location / {
root /usr/local/appkg/;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
上面的三個配置中:
autoindex on,顯示目錄
autoindex_exact_size on,顯示文件大小
autoindex_localtime on,顯示文件時間
測試配置是否正常:
nginx -t
重啓 Nginx:
nginx -s reload
訪問:
會顯示文件列表:
Index of /
../
docker-centos7.tar 28-Nov-2019 15:31 1586932736
作者 Github : tojohnonly , 博客 : EnskDeCode