1. 程式人生 > >squid的ncsa_auth用戶認證代理

squid的ncsa_auth用戶認證代理

squid的ncsa_auth用戶認證代理

1、安裝squid、http

#yum install -y squid httpd

2、配置NCSA認證

①創建認證用戶名密碼,使用Http的htpasswd

#htpasswd  /etc/squid/passwd carl

②確定squid是否支持authentication helper

#rpm -ql squid | grep ncsa_auth

輸出

/usr/lib64/squid/ncsa_auth   此為下配置文件中ncsa認證文件的位置

③配置squid.conf

#vim /etc/squid/squid.conf
##需要更改
http_port 8808 #squid服務端口號
 
##需要增加
auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd //定義squid密碼文件與ncsa_auth文件位置
auth_param basic children 15 //認證進程的數量
auth_param basic realm Squid proxy-caching web server //squid做基本代理web緩存
auth_param basic credentialsttl 2 hours //認證有效期
auth_param basic casesensitive off //用戶名不區分大小寫,可改為ON區分大小寫
#註:以上5行內容配置文件,需配置在acl及http_access行上,否則啟動squid會報
#Can‘t use proxy auth because no authentication schemes are fully configured.
#FATAL: ERROR: Invalid ACL: acl carl proxy_auth REQUIRED
 
#在acl行適當位置增加
acl carl proxy_auth REQUIRED
#在http_access deny manager上一行增加
http_access allow carl

④重啟squid

#/etc/init.d/squid restart


本文出自 “尼古風鎖絲愁過” 博客,請務必保留此出處http://smoke520.blog.51cto.com/9256117/1963366

squid的ncsa_auth用戶認證代理