root@proxy squid]# cat squid.conf
#
# Recommended minimum configuration:
#
visible_hostname www.jd.com #设置代理服务器名称
cache_mgr 888888@163.com #设置缓存管理员邮箱
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
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 vlan1 src 192.168.1.0/24 #定义一个网段
acl baidu dstdomain .baidu.com #定义一个域名,www可以不写 。一定要写
acl test url_regex ^http://www.rhce.cc/test/.*\.txt # 定义一个网站的txt文件
acl txt urlpath_regex \.txt& #定义所有网站的txt文件
acl zhangsan src 192.168.1.4/32 #定义一个ip
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443

acl Mail_ports port 110     # pop3  定义POP3端口号
acl Mail_ports port 25        # smtp 定义SMTP端口号
acl Mail_ports port 143     # imap   定义IMAP端口号
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

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports

http_access allow Mail_ports    #允许邮件客户端使用代理收发pop3邮件或者IMAP邮件协议
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow vlan1  #允许vlan1上网 备注:此处分优先级
cache deny txt #所有的网站的txt文件不做缓存
http_access deny baidu
http_access deny zhangsan #禁止zhangsan使用代理服务器
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 8889  #设置代理服务器端口为8889

# Uncomment and adjust the following to add a disk cache directory.
cache_swap_low 90 #设置硬盘的缓存最低为90%
cache_swap_high 95 #设置硬盘的缓存所占硬盘空间的95%,超过95%,删除5%老数据,回到硬盘空间90%
cache_mem 10 MB #设置内存中的缓存
cache_dir ufs /var/spool/squid 100 16 256
#缓存存放位置100代表100M,16代表16个目录,每个目录里面还有256子目录,请尽量启用此功能
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

# Add any of your own refresh_pattern entries above these.
#设置缓存时间,最小为1440分钟,最大为10080分钟,超过10080认为老数据
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代理服务器配置详解的更多相关文章

  1. CAS (5) —— Nginx代理模式下浏览器访问CAS服务器配置详解

    CAS (5) -- Nginx代理模式下浏览器访问CAS服务器配置详解 tomcat版本: tomcat-8.0.29 jdk版本: jdk1.8.0_65 nginx版本: nginx-1.9.8 ...

  2. 使用Squid做代理服务器,Squid单网卡透明代理配置详解(转)

    使用Squid做代理服务器 说到代理服务器,我们最先想到的可能是一些专门的代理服务器网站,某些情况下,通过它们能加快访问互联网的速度.其实,在需要访问外部的局域网中,我们自己就能设置代理,把访问次数较 ...

  3. 【转】VPN服务器配置详解

    参考博文: VPN服务器配置详解   等公司上服务器开始配置 vpn

  4. Java 反射 设计模式 动态代理机制详解 [ 转载 ]

    Java 反射 设计模式 动态代理机制详解 [ 转载 ] @author 亦山 原文链接:http://blog.csdn.net/luanlouis/article/details/24589193 ...

  5. Docker Kubernetes Service 网络服务代理模式详解

    Docker Kubernetes  Service 网络服务代理模式详解 Service service是实现kubernetes网络通信的一个服务 主要功能:负载均衡.网络规则分布到具体pod 注 ...

  6. 【转】java的动态代理机制详解

    java的动态代理机制详解   在学习Spring的时候,我们知道Spring主要有两大思想,一个是IoC,另一个就是AOP,对于IoC,依赖注入就不用多说了,而对于Spring的核心AOP来说,我们 ...

  7. java的动态代理机制详解-----https://www.cnblogs.com/xiaoluo501395377/p/3383130.html

    java的动态代理机制详解-----https://www.cnblogs.com/xiaoluo501395377/p/3383130.html

  8. 引用 Windows Server 2003 FTP服务器配置详解

    引用 昆神之星 的 Windows Server 2003 FTP服务器配置详解 1.FTP文件传输协议,主要用于计算机之间文件传输,是互联网上仅次于www的第二大服务.本文主要演示如何在Window ...

  9. 代理模式详解:静态代理+JDK/CGLIB 动态代理实战

    1. 代理模式 代理模式是一种比较好的理解的设计模式.简单来说就是 我们使用代理对象来代替对真实对象(real object)的访问,这样就可以在不修改原目标对象的前提下,提供额外的功能操作,扩展目标 ...

随机推荐

  1. iOS--cocopod升级新版本

    上面那个也可安装.cocopod

  2. HashTable、HashMap、HashSet

    1. HashMap 1)  hashmap的数据结构 Hashmap是一个数组和链表的结合体(在数据结构称“链表散列“),如下图示: 当我们往hashmap中put元素的时候,先根据key的hash ...

  3. Java网络编程——IP

    类:InetAdrress 该类主要用于表示互联网协议(IP对象)地址,且无构造方法 主要方法: public static InetAddress getLocalHost()-->返回本地主 ...

  4. CSS选择器优先级排列

    CSS选择器的效率从高到低做了一个排序: 1.id选择器(#myid) 2.类选择器(.myclassname) 3.标签选择器(div,h1,p) 4.相邻选择器(h1+p) 5.子选择器(ul & ...

  5. 给Linux装图形化界面

    在工作中遇到这种情况,安装confluence服务的时候需要调用图形化桌面,但是原来装系统的时候是最小化装的,所以这里就麻烦了 给装图形化吧 在我们安装Linux系统时,刚开始的时候可能没有安装图形界 ...

  6. zabbix的安装

    1  lamp环境搭建以及zabbix安装 方便的话使用yum方式(yum安装的是2.2版本) 安装epel环境 yum install -y epel-release 安装lamp环境 yum in ...

  7. safe RGB colors

    RGB是面向机器的一种颜色空间. 虽然它表示\(256 \times 256 \times 256\)种不同的颜色, 但在实际中, 大部分机器都只实现了256种颜色. 安全色(Safe RGB col ...

  8. Python之几种重要的基本类型:元组,列表,字典,字符串,集合

    写在前面:重点讲解元组,列表,字典相关概念和常用操作. 一.元组(tuple) 1.特性:不可更改的数据序列.[理解:一旦创建元组,则这个元组就不能被修改,即不能对元组进行更新.增加.删除操作] 2. ...

  9. Yii日志记录Logging

    .Yii::getLogger()->log($message, $level, $category = 'application') .Yii::trace($message, $catego ...

  10. 【bzoj3240】 Noi2013—矩阵游戏

    http://www.lydsy.com/JudgeOnline/problem.php?id=3240 (题目链接) 题意$${F[1][1]=1}$$$${F[i][j]=a*F[i][j-1]+ ...