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 %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

 

  

你可能感兴趣的:(java技术)