NOTE
1.3 File Server
A simple Nginx file server using autoindex.
This is a historical learning note and may contain outdated or incomplete understanding.
1. Configuration
The original note uses Nginx autoindex to expose a directory as a simple file server.
/etc/nginx/nginx.conf:
http {
# ...
include /etc/nginx/conf.d/*.conf;
# ...
}
/etc/nginx/conf.d/cdn.conf:
autoindex on; # enable directory index
autoindex_exact_size off; # show human-readable approximate sizes
autoindex_localtime on; # display local time
charset utf-8;
server {
listen 9999;
root $HOME/share;
error_log $HOME/share/log/error.log;
location / {
}
}
Do not expose private directories with autoindex on an untrusted network unless access control and file permissions are intentionally configured.