Nginx配置密码访问

HTML  2022-02-17 17:15  397  

1.使用htpasswd生成密码,命令不存在就安装httpd-tools:

htpasswd -bc htpasswd username password

2.nginx配置,配在server下面:

auth_basic "Restricted Access";
auth_basic_user_file htpasswd ;

发布于 2022-02-17 17:15, 最后修改于2022-02-17 17:15