type
status
date
slug
summary
tags
category
created days
new update day
icon
password
Created_time
Dec 8, 2022 02:52 AM
Last edited time
Mar 1, 2025 01:50 AM
1 创建htpasswd文件
可以使用下面这个python脚本生成认证文件
2 执行命令 授予脚本执行权限
此处是测试演示所以权限赋予了
777
实际实用的时候应自己进行配置。其中 htpasswd是生成的文件名,username 是用户名,password是对应的密码
3 把生成的文件复制到 nginx 文件夹里
eg:/etc/nginx/
修改 nginx 的
conf
或 nginx 的虚拟服务器配置文件,
在 server 条目上加上这两句- 然后重启nginx
OK!大功告成!
- 作者:tangcuyu
- 链接:https://expoli.tech/articles/2018/04/16/1564656224308
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。
相关文章