您的位置:首页 > 运维架构 > 反向代理

Linux与云计算——第二阶段 第一十一章:代理Proxy服务器架设—Squid进行基础认证

2016-08-11 18:02 726 查看

[b]Linux与云计算——第二阶段Linux服务器架设[/b]

第一十一章:代理Proxy服务器架设—Squid进行基础认证

基础认证

配置基础认证并且限制用户必须使用认证。

[1] 安装软件包以便包含htpasswd.

[root@server ~]# yum -y install httpd-tools

[2] 配置Squid设置Basic Auth.

[root@server ~]# vi /etc/squid/squid.confacl CONNECT method CONNECT# line 26: 添加以下行来开启认证auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/.htpasswdauth_param basic children 5auth_param basic realm Squid Basic Authenticationauth_param basic credentialsttl 5 hoursacl password proxy_auth REQUIREDhttp_access allow password# 添加一个用户[root@server ~]# htpasswd -c /etc/squid/.htpasswd jeffrey [root@server ~]# systemctl restart squid

[3] 配置客户端.

[root@client ~]# vi /etc/profile# add follows to the end# username:password@proxyserver:portMY_PROXY_URL="http://jeffrey:redhat@server.example.com:8080/"HTTP_PROXY=$MY_PROXY_URLHTTPS_PROXY=$MY_PROXY_URLFTP_PROXY=$MY_PROXY_URLhttp_proxy=$MY_PROXY_URLhttps_proxy=$MY_PROXY_URLftp_proxy=$MY_PROXY_URLexport HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy[root@client ~]# source /etc/profile# 针对YUM[root@client ~]# vim /etc/yum.conf# 在后面添加proxy=http://server.example.com:8080/proxy_username=jeffreyproxy_password=redhat# 针对wget[root@client ~]# vi /etc/wgetrc# 在后面添加http_proxy = http://server.example.com:8080/https_proxy = http://server.example.com:8080/ftp_proxy = http://server.example.com:8080/proxy_user = jeffreyproxy_passwd = redhat
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  基础 squid 认证