1.生成密码文件
htpasswd -c -d /usr/local/nginx/conf/pass_file username
2.添加用户
htpasswd -d /usr/local/nginx/conf/pass_file username
3.在nginx配置文件的server里添加如下
location ~ / {
location ~ .*\.(php|php5)?$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
auth_basic "Authorized users only";
auth_basic_user_file /usr/local/nginx/conf/pass_file;
}
nginx访问页面设置密码
最新推荐文章于 2024-05-28 08:37:26 发布