1. Install squid and HTTP
#yum install -y squid httpd
2. Configure NCSA Authentication
① Create an authentication username and password and use the HTTP htpasswd
#htpasswd /etc/squid/passwd carl
② Determine whether Squid supports authentication helper
#rpm -ql squid | grep ncsa_auth
Output
/Usr/lib64/squid/ncsa_auth: the location of the NCSA authentication file in the configuration file
③ Configure squid. conf
# Vim/etc/squid. conf ## change http_port 8808 # squid service port number # Add auth_param BASIC Program/usr/lib64/squid/ncsa_auth/etc/squid/passwd // to define the squid password file and ncsa_auth file Location auth_param basic children 15 // Number of authentication processes auth_param basic realm Squid proxy-caching Web Server // squid performs basic proxy Web Cache auth_param basic credentialsttl 2 hours // authentication validity period auth_param basic casesensitive off // the user name is case insensitive, can be changed to on case sensitive # Note: The content configuration file of the above five rows must be configured on the ACL and http_access lines, otherwise, the # Can't use proxy auth because no authentication schemes are fully configured will be reported when squid is started. # fatal: Error: Invalid ACL: ACL Carl proxy_auth required # Add the ACL Carl proxy_auth required in the appropriate position of the ACL line # Add http_access allow Carl in the line of http_access deny Manager
④ Restart squid
#/etc/init.d/squid restart