The file server built by nginx under windows comes with basic verification function

Time:2021-7-27

The file server built by nginx under windows comes with basic verification function

Configure nginx

Add the following configuration file to the configuration file of nginx

server {
    listen       7777 default_server;
    listen       [::]:7777 default_server;

    location / {
        #File directory
        alias D:/share;
        #Basic verification
        auth_basic "nginx basic auth";
        auth_basic_user_file C:/nginx/conf/htpasswd;
        #File display function
        autoindex on;    # Enable index function
        autoindex_ exact_ size off;  # Turn off the calculation of the exact size of the file (in bytes), and only the approximate size (in KB, MB, GB) is displayed
        autoindex_ localtime on;   # Display local time instead of GMT time
    }
}

New user file

Create a new htpasswd file in C: / nginx / conf, and create a new user according to the following arrangement

username:password

reload nginx

nginx.exe -s reload

You can access the file service by entering your account and password on the website

Welcome to my personal blogximikang.icu

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]