squid windows配置

1.修改squid/etc/squid.conf文件,编辑如下信息:

(1)缓存文件路径:cache_dir ufs C:/squid/var/cache 100000 16 256

(2)host文件路径:hosts_file C:/squid/etc/hosts

(3)log文件路径:access_log C:/squid/var/logs/access.log combined

(4)端口信息:
http_port 80 vhost
icp_port 3188

(5)机器IP信息
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl purge method purge
acl localhost src 127.0.0.1/255.255.255.255
acl tools src  局域网IP 外网IP 127.0.0.1
acl mynet src 局域网IP 外网IP 127.0.0.1

(6)url相关配置:
http_access allow roneaseproject
http_access allow manager tools
http_access allow purge tools
http_access deny all

# === cache_peer define
cache_peer web-ronease-project parent 8080 0 no-query originserver weight=2000

# === cache_peer access
cache_peer_access web-ronease-project allow roneaseproject
cache_peer_access web-ronease-project deny all

(7)修改hosts文件
局域网IP 域名  web-ronease-project

执行流程:
域名请求-->80端口请求被squid捕获-->查找hosts文件配置-->对应"web-ronease-project"-->再读取squid.conf配置文件-->根据配置找到相应的应用服务器

 

配置文件全文如下:

(1)squid.conf

visible_hostname cache.ronease.gov.cn
cache_effective_user squid
cache_effective_group squid
# cache config: space use 40G and memory use 2G
cache_mem 1024 MB
cache_swap_low 80
cache_swap_high 97
maximum_object_size 30 MB
maximum_object_size_in_memory 8 MB
#cache_replacement_policy heap LFUDA
#memory_replacement_policy heap LRU
# === cache_dir ufs C:/squid/var/cache 40000 16 256
cache_dir ufs C:/squid/var/cache 100000 16 256
persistent_request_timeout 30 minute
# === define port ===
http_port 80 vhost
icp_port 3188

# === acl define ===
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl purge method purge
acl localhost src 127.0.0.1/255.255.255.255
acl tools src 局域网IP 外网IP 127.0.0.1
acl mynet src 局域网IP 外网IP 127.0.0.1

acl roneaseproject dstdomain 域名


#acl static urlpath_regex /(images|flash|sysimage)/
#acl www-static urlpath_regex /web/center

# === icp_access ===
icp_access allow mynet
icp_access deny all

log_icp_queries off

# === http_access_define
http_access allow roneaseproject
http_access allow manager tools
http_access allow purge tools
http_access deny all

http_reply_access allow all

# === cache_peer define
cache_peer web-ronease-project parent 8080 0 no-query originserver weight=2000

# === cache_peer access
cache_peer_access web-ronease-project allow roneaseproject
cache_peer_access web-ronease-project deny all


# == refresh_pattern define
#refresh_pattern 222.184.79.10/jsp/wdgzs$ 0 0% 0
refresh_pattern /.css$ 14400 1000% 28800 reload-into-ims ignore-reload
refresh_pattern -i /.jpg$ 14400 1000% 28800 reload-into-ims ignore-reload
refresh_pattern -i /.gif$ 14400 1000% 28800 reload-into-ims ignore-reload
refresh_pattern -i /.css$ 14400 1000% 28800 reload-into-ims ignore-reload
refresh_pattern -i /.js$ 14400 1000% 28800 reload-into-ims ignore-reload
#refresh_pattern /$ 30 100% 30 reload-into-ims ignore-reload

refresh_pattern . 0 0% 0

#..emulate_httpd_log..,..Squid..Aapche.....
emulate_httpd_log on
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %{host}>h
# === other setting
hosts_file C:/squid/etc/hosts
access_log C:/squid/var/logs/access.log combined

(2)hosts文件

局域网IP 域名  web-ronease-project

 

  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值