Quantcast
Viewing all articles
Browse latest Browse all 290

htpasswd的Shell替代命令

当用nginx的时候,可能需要限制登陆

一句话解决

printf "admin:$(openssl passwd -crypt 123456)\n" > .htpasswd  

nginx的配置如下:

        location /
        {
                auth_basic "nginx basic http test for ttlsa.com";
                auth_basic_user_file /data/html/.htpasswd; 
                autoindex on;
        }

Viewing all articles
Browse latest Browse all 290

Trending Articles