`

squid.conf

 
阅读更多

 

##
# 版本: squid-2.6.STABLE6
##

visible_hostname testserver

http_port 192.168.0.10:80 vhost vport

cache_mem 50 MB
cache_dir ufs /www/squid2.6/var/cache 300 16 256
coredump_dir /www/squid2.6/var/cache
cache_swap_low 80
cache_swap_high 85


maximum_object_size 1024 KB



hierarchy_stoplist cgi-bin ?

acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY


acl apache rep_header Server ^Apache
broken_vary_encoding allow apache

# 定义日志格式:
logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
logformat squidmime  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt [%>h] [%<h]
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st %Ss:%Sh
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
# 日志文件路径及格式:
access_log /www/squid2.6/var/logs/access.log common
logfile_rotate 1000


# 刷新时间:
refresh_pattern -i \.htm$   0  50% 10080
refresh_pattern -i \.html$  0  50% 10080
refresh_pattern -i \.shtml$ 0  50% 10080

refresh_pattern -i \.gif$   0  50% 10080
refresh_pattern -i \.swf$   0  50% 10080
refresh_pattern -i \.jpg$   0  50% 10080
refresh_pattern -i \.png$   0  50% 10080
refresh_pattern -i \.bmp$   0  50% 10080

refresh_pattern -i \.js$    0  50% 10080
refresh_pattern -i \.jsp$   0  50% 10080
refresh_pattern -i \.php$   0  50% 10080
refresh_pattern -i \.asp$   0  50% 10080

refresh_pattern -i \.doc$   0  50% 10080
refresh_pattern -i \.ppt$   0  50% 10080
refresh_pattern -i \.xls$   0  50% 10080
refresh_pattern -i \.pdf$   0  50% 10080
refresh_pattern -i \.rar$   0  50% 10080
refresh_pattern -i \.zip$   0  50% 10080

refresh_pattern ^ftp:        1440        20%        10080
refresh_pattern ^gopher:        1440        0%        1440
refresh_pattern .                0        20%        10080



acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
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 allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

acl all src 0.0.0.0/0.0.0.0
http_access allow all


http_reply_access allow all

icp_access allow all



#################
#
#  反向代理begin
#

cache_peer 192.168.0.10 parent 80 0 no-query originserver name=testserver80
cache_peer_domain testserver80 www.testserver81.com
cache_peer_domain testserver80 www.test181.com
cache_peer_domain testserver80 www.test281.com
cache_peer_domain testserver80 www.test381.com

cache_peer 192.168.0.11 parent 81 0 no-query originserver name=testserver81
cache_peer_domain testserver81 www.testserver82.com
cache_peer_domain testserver81 www.test182.com
cache_peer_domain testserver81 www.test282.com
cache_peer_domain testserver81 www.test382.com

cache_peer 192.168.0.12 parent 8080 0 no-query originserver name=testserver8080
cache_peer_domain testserver8080 www.testserver8080.com
cache_peer_domain testserver8080 www.test18080.com
cache_peer_domain testserver8080 www.test28080.com
cache_peer_domain testserver8080 www.test38080.com

#
#  反向代理end
#
################
分享到:
评论

相关推荐

    官方原始配置文件 : /etc/squid/squid.conf

    官方原始配置文件 : /etc/squid/squid.conf ubuntu 22.04 apt install squid

    squid配置https

    2. **编辑 Squid 配置文件** (`squid.conf`): - 启用 HTTPS 代理端口,并指定证书和私钥路径。 ```plaintext https_port 443 cert=/root/http.crt key=/root/http.key ``` - 设置默认站点。 ```plaintext ...

    squid详细配置

    Squid 的主配置文件位于 `/etc/squid/squid.conf`。其中包含了各种配置选项,包括但不限于: - **服务端口配置**:`http_port 3128` - **缓存内存数量**:`cache_mem 8MB`(通常建议设置为服务器物理内存的三分之一...

    squid编译安装及配置详解.pdf

    4. 测试 squid.conf 文件:使用 squid 命令测试 squid.conf 文件的语法信息,例如 `# squid/sbin/squid -k parse`。 三、 Squid 的重要文件 1. /etc/squid/squid.conf:Squid 的主配置文件。 2. /etc/squid/errors...

    squid配置文档

    cp /etc/squid/squid.conf /home # 删除默认配置文件 cd /etc/squid rm –f squid.conf ``` 然后,我们需要创建一个新的配置文件: ```bash # 新建配置文件 cd /etc/squid touch squid.conf ``` 编辑新配置文件 ...

    squid-3.5.28.tar.gz

    安装完成后,主要配置文件为`/etc/squid/squid.conf`。配置项包括监听端口、缓存目录、访问控制规则等。 四、Squid使用实例 1. **作为透明代理**:通过修改网络设备的配置,使所有流量经过Squid,实现无感知的代理...

    squid-2.7.STABLE8-for windows

    2. **配置Squid**:Squid的核心配置文件是`squid.conf`。在解压后的文件夹中找到这个文件,使用文本编辑器(如Notepad++)打开。根据你的需求,你需要修改默认配置,包括设置监听端口(默认3128),定义缓存目录,...

    Squid.Definitive.Guide

    - **配置文件**:主要修改`/etc/squid/squid.conf`,包括监听端口、访问控制、缓存策略等。 3. **Squid缓存策略** - **内存缓存**:Squid可以根据系统资源设置内存缓存大小。 - **磁盘缓存**:配置缓存目录,...

    squid for windows 安装方法.doc

    - 使用`copy squid.conf.default squid.conf`命令复制默认配置文件`squid.conf.default`为`squid.conf`。 - 使用`copy mime.conf.default mime.conf`命令复制默认MIME类型配置文件`mime.conf.default`为`mime.conf...

    Squid Windows版架设二级代理服务器

    - 复制`C:\squid\etc`目录下的`squid.conf.default`为`squid.conf`。 - 同样复制`cachemgr.conf.default`为`cachemgr.conf`。 - 复制`mime.conf.default`为`mime.conf`。 #### 配置Squid 1. **编辑`squid.conf`...

    squid-3.5.25.tar.gz

    6. **配置文件**:编辑`/etc/squid/squid.conf`配置文件,根据实际需求配置Squid的各种参数。 7. **启动与管理**:使用`systemctl start squid`启动Squid服务,`systemctl enable squid`设置开机启动,`systemctl ...

    squid包含htpasswd.exe

     C:squidetc&gt;copy mime.conf.default mime.conf **将mime.conf.default复制一份并起名为mime.conf 下面,我们可以使用任意文本编辑器对squid.conf(配置文件)进行编辑,修改squid的配置语句,文件中的#后的文本表示...

    代理服务器squid.pptx

    Squid 的主要配置文件是 `/etc/squid/squid.conf`。在这个文件中,你可以定义访问控制规则、缓存设置等。访问控制是 Squid 的一个重要特性,通过 `acl` 命令定义不同的访问控制列表(ACL),然后使用 `http_access` ...

    Squid 中文权威指南(4)

    Squid安装后,默认配置文件`squid.conf.default`存放在`$prefix/etc`目录下,包含了每个指令的注释和默认值。安装后应仔细检查此文件,以了解最新的指令变更和默认配置。 #### 四、用户ID配置 在Unix系统中,Squid...

    RHCE253--架设Squid服务器.doc

    6. 配置文件:/etc/squid/squid.conf 是主配置文件,需要修改之前最好先作好备份,默认已经有 squid.conf.default。 四、 ACL 访问控制应用 ACL 访问控制应用可以限制用户的访问权限,控制用户可以访问的资源。 ...

    squid 多ip出口认证

    grep -v "^#" etc/squid.conf.default|uniq &gt; etc/squid.conf vi /etc/squid.conf ``` 添加以下内容: ``` acl CONNECT method CONNECT http_access allow manager localhost include "/usr/local/squid/etc/auth....

    AIX成功配置SQUID

    进入 `/usr/local/squid/etc` 目录,复制 `mime.conf.default` 为 `mime.conf` 和 `squid.conf.default` 为 `squid.conf`。`mime.conf` 文件用于定义不同文件类型的处理方式,而 `squid.conf` 是主要的配置文件,...

    linux下squid服务器的配置与管理归纳.pdf

    在实验中,我们首先需要查看 Squid 服务器的安装情况和主机名,然后修改配置文件(位于 /etc/squid/squid.conf)。 ### Step2: 修改配置文件 在实验中,我们将修改配置文件(位于 /etc/squid/squid.conf),然后...

    squid 2.6 for window

    安装完成后,配置文件`squid.conf`应被放置在指定的目录下,例如`C:\squid\etc\squid.conf`。调试过程包括启动Squid服务,检查日志文件,确保没有错误,并测试代理功能是否正常工作。 六、维护与优化 运行Squid时,...

Global site tag (gtag.js) - Google Analytics