auth_basic_user_file /path/to/htpasswd.conf;
nginx用户认证
原创
©著作权归作者所有:来自51CTO博客作者lynnteng0的原创作品,请联系作者获取转载授权,否则将追究法律责任
nagios的监控页面,awstats的统计页面,使用nginx作为web服务,因为使用的是公网,直接爆露在外面,任何人都能够查看得到,需要增加一个用户认证
使用nginx登录认证,需要用到ngx_http_auth_pam_module模块
需要下载软件:
nginx-1.0.9.tar.gz
ngx_http_auth_pam_module-1.1.tar.gz
安装前需要先安装pam,如果系统没有缺少pam-dev的话,会报pam的错误
yum install pam*
tar –xzf nginx-1.0.9.tar.gz
tar –xzf ngx_http_auth_pam_module-1.1.tar.gz
cd nginx-1.0.9
./configure --prefix=/usr/local/nginx_auth --with-http_realip_module --with-http_p_w_picpath_filter_module --with-http_gzip_static_module --with-http_random_index_module --with-http_perl_module --add-module=../ngx_http_auth_pam_module-1.1
make && make install
用htpasswd命令生成需要认证的用户和密码
htpasswd –c /path/to/htpasswd.conf username
nginx配置
auth_basic "AwstatsAuth";
auth_basic_user_file /path/to/htpasswd.conf;
auth_basic_user_file /path/to/htpasswd.conf;
配置好之后重启nginx,ok
上一篇:nagios安装
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
实战Nginx web用户认证
实战nginx 下的目录和指定文件类型的认证。
nginx nginx 认证 -
Linux- Nginx用户认证
Linux- Nginx用户认证
Linux 用户认证 -
Nginx用户验证 nginx用户认证
修改Nginx配置文件 [root@proxy ~]# vim /usr/local/nginx/conf/nginx.conf server { //一个server就相当于一个网页 listen 80;
Nginx用户验证 算法 nginx linux https