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

2019-04-14 17:09发布

下載ngx_http_stub_status_module模塊, ./configure --with-http_stub_status_module 配置status状态配置文件 vi status.conf server_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即可