利用nginx搭建文件服务器并使用登录功能

发布时间 2023-07-11 17:04:06作者: 小小爬虫

nginx配置

http {
    #显示目录
    autoindex on;
    #显示文件大小
    autoindex_exact_size on;
    #显示文件时间
    autoindex_localtime on;
    #设置编码方式
    charset utf-8;
    server {
        listen       80;
        server_name  localhost;
        #文件目录根路径
        root /home/file;
        #开启
        auth_basic "hello auth";
        auth_basic_user_file passwd.db;
        satisfy all;
        allow 127.0.0.1/32;
        deny all;
    }
}