nginx添加访问控制htpasswd及status配置

来源:互联网 发布:免费杀毒软件知乎 编辑:程序博客网 时间:2024/05/01 02:51

下載ngx_http_stub_status_module模塊,

./configure --with-http_stub_status_module

配置status状态配置文件

vi status.confserver_name status.abc.cn;location{  stub_status on; #<==打開狀態信息開關  access_log off;  root /html/status;  index index.html;  auth_basic “abc login”;  //用於設置認證提示符“”  auth_basic_user_file /application/nginx/conf/htpasswd#<<== nginx conf放置密码的目錄路勁}

yum install -y httpd #<==安装htpasswd

which htpasswd

/usr/bin/htpasswd

配置htpasswd账户

htpasswd -bc /application/nginx/conf/htpasswd(nginx的安裝路勁) oldboy 123456

chmod 400 /application/nginx/conf/htpasswd

chown nginx /application/nginx/conf/htpasswd

nginx -t

访问status.abc.cn即可

0 0
原创粉丝点击