标签:The 配置nginx you 访问 apt-get name http ati res
针对sudo apt-get install命令安装的nginx(默认会有/etc/nginx/conf.d)
sudo apt-get install nginx
printf "your_username:$(openssl passwd -crypt your_password)\n" >> conf.d/passwd
如果没有conf.d/passwd这个文件,就自行创建
修改配置文件:
vim /etc/nginx/sites-enabled/default
修改内容如下:
location / { auth_basic "网站名称"; auth_basic_user_file conf.d/passwd; autoindex on; }
/etc/init.d/nginx restart
为 Nginx 添加 HTTP 基本认证(HTTP Basic Authentication)
标签:The 配置nginx you 访问 apt-get name http ati res
原文地址:https://www.cnblogs.com/youcong/p/11253241.html