没有什么花里胡哨的编译,就是 ./configure --enable-auth=basic,ntlm
略微根据实际情况改了一下squid.conf
挺好使,没事别乱改,想清楚再改。
[root@proxy scripts]# cat /Data/software/squid/etc/squid.conf
#Kerberos authentication
#auth_param negotiate program /Data/software/squid/libexec/squid_kerb_auth -d 3 -s HTTP/[email protected]
#auth_param negotiate children 15
#auth_param negotiate keep_alive on
#ntlm_auth
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp
auth_param ntlm children 20
#auth_param ntlm use_ntlm_negotiate on
#basic_auth
auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic
auth_param basic children 10
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
#Kerberos authentication
#auth_param negotiate program /Data/software/squid/libexec/squid_kerb_auth -d 3 -s HTTP/[email protected]
#auth_param negotiate children 15
#auth_param negotiate keep_alive on
#ntlm_auth
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp
auth_param ntlm children 20
#auth_param ntlm use_ntlm_negotiate on
#basic_auth
auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic
auth_param basic children 10
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
cachemgr_passwd xxxxx all #cachemgr 密码
acl all src all
acl auth proxy_auth REQUIRED
acl all src all
acl auth proxy_auth REQUIRED
#DeniedURLs and IPs
#acl DeniedURLs dstdomain -i .qq.com .tencent.com #简单的过滤目的网站url规则
#acl DeniedIPs dst "/Data/software/squid/etc/deniedIPs.list" #简单的过滤目的网站IP规则
acl manager proto cache_object
acl webserver src 172.18.9.146/32
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl directout src '/Data/software/squid/etc/AllowedIPs.list" #允许列表的不需要通过用户认证直接使用proxy
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
#http_access deny DeniedURLs
#http_access deny DeniedIPs
http_access allow manager localhost
http_access allow manager webserver
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow directout
http_access deny !auth
http_access allow auth
http_access deny all
#icp_access allow localnet #no need to query icp peer
icp_access deny all
http_port 172.18.9.146:3128 #如果你有多块网卡多个IP,这样设置合理点
hierarchy_stoplist cgi-bin ?
access_log /Data/software/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mem 256 MB # 我是2G物理内存,我想留点余地。等用户多了,我再加点,目前运行挺好
maximum_object_size 20 MB
cache_dir ufs /Data/software/squid/var/cache 8000 32 256 #4块硬盘做的软RAID5,这样配置还算保守,这个改完好记住要重新初始化cache , 命令"squid -z"
cache_mgr [email protected]
icp_port 0 #disable icp 暂时没钱,单节点,不需要icp
#acl DeniedURLs dstdomain -i .qq.com .tencent.com #简单的过滤目的网站url规则
#acl DeniedIPs dst "/Data/software/squid/etc/deniedIPs.list" #简单的过滤目的网站IP规则
acl manager proto cache_object
acl webserver src 172.18.9.146/32
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl directout src '/Data/software/squid/etc/AllowedIPs.list" #允许列表的不需要通过用户认证直接使用proxy
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
#http_access deny DeniedURLs
#http_access deny DeniedIPs
http_access allow manager localhost
http_access allow manager webserver
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow directout
http_access deny !auth
http_access allow auth
http_access deny all
#icp_access allow localnet #no need to query icp peer
icp_access deny all
http_port 172.18.9.146:3128 #如果你有多块网卡多个IP,这样设置合理点
hierarchy_stoplist cgi-bin ?
access_log /Data/software/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
cache_mem 256 MB # 我是2G物理内存,我想留点余地。等用户多了,我再加点,目前运行挺好
maximum_object_size 20 MB
cache_dir ufs /Data/software/squid/var/cache 8000 32 256 #4块硬盘做的软RAID5,这样配置还算保守,这个改完好记住要重新初始化cache , 命令"squid -z"
cache_mgr [email protected]
icp_port 0 #disable icp 暂时没钱,单节点,不需要icp