给自己看的squid服务器配置笔记

编译参数:

iptables -t nat -A PREROUTING -s 192.168.0.0/24 -p tcp --dport 80 -j REDIRECT --to-ports 3128

编译源码
./configure --prefix=/usr/local/squid
--enable-arp-acl 
--enable-linux-netfilter 
--enable-auth="basic" 
--enable-baisc-auth-helpers="NCSA"     #########加上认证模块
--enable-underscore

#########################################

auth_param basic program /usr/bin/ncsa_auth /etc/squid/password ## 指定passwd文件
auth_param basic children 5  ##可以登录用户个数
auth_param basic credentialsttl 2 hours
visible_hostname  gzud10018  ##本地服务器主机名
acl auth  proxy_auth REQUIRED    ##启动acl 登录认证
acl all src 0.0.0.0    ##配置 acl  名字为 all  样式为 src
#acl manager proto cache_object
acl to dst 219.133.34.92   ####acl 名字为 to,样式为dst ,
acl to dst 219.133.34.69
acl to dst 219.133.34.77
acl to dst 219.133.36.38
acl to dst 219.133.36.39
acl to dst 219.133.59.156
acl to dst www.8788.cn  ##也可以配置成域名
cache_access_log /etc/squid/access.log  ##日志
cache_log /etc/squid/cache.log
cache_store_log /etc/squid/store.log
acl Safe_ports port 80          #acl别名safe_port    样式为 port 
acl Safe_ports port 41832
acl CONNECT method CONNECT
#http_access allow manager
http_access allow auth to     ### allow auth,to 这2个acl别名
http_access deny all       ##deny ,all这个acl别名
http_access deny !Safe_ports !to     ##deny不在 safe_port 这个别名范围内的端口
http_port 41832 ##设置squid 服务器 监听端口
##############################此配置效果为,所有经过代理服务器的客户端,均要输入用户验证,验证后,
##############################若客户端不是访问指定的ip或者域名内,将无法使用代理服务,直接显示拒绝
# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?
coredump_dir /etc/squid/var/cache
 
# Add any of your own refresh_pattern entries above these.
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

你可能感兴趣的:(职场,笔记,squid,服务器配置,休闲)