nginx.conf
要删掉根目录下的index.html 如果存在会导致以下配置无效
server
{
...
#权限
add_header Cache-Control no-cache;
auth_basic "User Authentication";# 添加这一行
auth_basic_user_file /www/wwwroot/d.abin.prohtpasswd;
#文件访问
charset utf-8;
autoindex on;
autoindex_exact_size off;
...
}
#权限
创建用户和密码
1.安装htpasswd工具
yum install httpd-tools
2.创建用户 (会让你输入两次密码)
密码文件
movie.abin.pro.htpasswd
不能在网站根目录下 否侧输入密码后报错500
htpasswd -c /www/wwwroot/movie.abin.pro.htpasswd abin
评论区