NOTE

1.3 文件服务器

使用 Nginx autoindex 搭建简单文件服务器。

Web Server / Nginx更新于 约 1 分钟读完historical

这是历史学习笔记,可能存在过时或不完整的理解。

1. 配置

  • /etc/nginx/nginx.conf
http {
    # ...
    include /etc/nginx/conf.d/*.conf;
    # ...
}
  • /etc/nginx/conf.d/cdn.conf
autoindex on;             # 开启索引功能
autoindex_exact_size off; # 只显示大概大小
autoindex_localtime on;   # 显示本机时间而非 GMT 时间
charset utf-8;

server {
    listen 9999;
    root $HOME/share;
    error_log $HOME/share/log/error.log;

    location / {
    }

    error_page 404 /404.html;
    location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    }
}

2. 参考

正在加载有帮助数量