打开 nginx.conf 配置文件,添加如下 server 块:
server {
listen 8080;
server_name localhost;
#charset koi8-r;
autoindex on; # 显示目录
autoindex_exact_size off; # 显示文件 简短大小
autoindex_localtime on; # 显示文件时间
root share;
#access_log logs/host.access.log main;
# location / {
# root ../www/s/;
# index index.html index.htm;
# }
重启 nginx 后,打开浏览器即可看到如下文件共享页面,点击链接即可下载:
<html>
<head><title>Index of /</title></head>
<body bgcolor="white">
<h1>Index of /</h1><hr><pre><a>../</a>
<a>BuildTools/</a> 24-Oct-2019 09:54 -
<a >go/</a> 24-Oct-2019 09:54 - -
<a >uniy5.6.4/</a> 24-Oct-2019 09:54 -
<a >BabeLua For 2013 V3.2.2.0.vsix</a> 18-Feb-2019 09:28 3M
<a >BabeLua For 2015 V3.2.2.0.vsix</a> 18-Feb-2019 09:28 4M
<a >Git-2.23.0-64-bit.exe</a> 21-Aug-2019 16:25 45M
<a >TianTianSetup-v1.4.1047-full.exe</a> 19-Mar-2018 10:06 317M
<a >TortoiseSVN-1.12.2.28653-x64-svn-1.12.2 (1).msi</a> 21-Aug-2019 16:29 19M
<a >VSCodeUserSetup-x64-1.37.1.exe</a> 21-Aug-2019 16:19 51M
<a >android-ndk-r16b-windows-x86_64.zip</a> 27-May-2019 21:00 690M
<a>cn_windows_10_consumer_edition_version_1803_upd..></a> 25-Aug-2018 16:49 5G
<a >vs2015.pro_chs.iso</a> 14-Oct-2019 11:49 4G
</pre><hr></body>
</html>