首页 > squid > 发一个自己用的squid.conf

发一个自己用的squid.conf

2010年9月10日 eric 发表评论 阅读评论

squid 3.1.X 有段时间了,发一个简单的配置文件:

squid $> cat /usr/local/squid/etc/squid.conf
visible_hostname nginxs.com
cache_effective_user www
cache_effective_group www

acl Safe_ports port 80
acl host dstdomain www.ninxs.com
acl localhost src 127.0.0.1/255.255.255.255
acl snmp src 192.168.6.102/255.255.255.255
acl manager proto cache_object
acl CONNECT method CONNECT
acl PURGE method PURGE

http_access allow manager localhost            # 只允许 本地访问 manager
http_access allow PURGE localhost               # 只允许 本地访问 PURGE
http_access deny manager                         # 其他的一律拒绝访问 manager
http_access deny !Safe_ports                     # 其他不是设置的 安全端口一律拒绝
http_access allow host                              # 只允许反向大代理 host = www.nginxs.com 域名站点
http_access deny all                                  # 其他的一律拒绝

http_port 80 accel vhost vport
cache_peer 124.42.10.51  parent 3128 0 no-query originserver name=nginx
cache_peer_domain tuokou www.nginxs.com
cache_dir ufs /usr/local/squid/var/cache 10000 12 128
cache_mem 2048 MB
max_open_disk_fds 0
minimum_object_size 0 KB
maximum_object_size 32 MB
maximum_object_size_in_memory 2048 KB
cache_swap_low 80
cache_swap_high 85
cache_store_log none

#acl QUERY urlpath_regex cgi-bin
acl nginxs urlpath_regex ^/eric/video/Grec\.php       #动态连接拿视频  例如 http://www.nginxs.com/eric/video/Grec.php?id=33&4.php?file=44
acl nginxs urlpath_regex ^/eric/file/Gfilep\.php         #动态连接拿文件  例如 http://www.nginxs.com/eric/video/Gfilep.php?id=33&4.php?file=45
acl QUERY urlpath_regex cgi-bin \? .php                        # 对其他的url 里有 .php 的不缓存
no_cache allow nginxs
no_cache deny QUERY

refresh_pattern -i ^http://www.nginxs.com/eric/video/Grec.php      1440    50%     10080   override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-no-store ignore-must-revalidate
refresh_pattern -i ^http://www.nginxs.com/eric/video/Gfilep.php       1440    50%     10080   override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-no-store ignore-must-revalidate
# override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-no-store ignore-must-revalidate 是针对返回的 header 使用的违规则~
refresh_pattern -i \.js$        1440    90%     129600  ignore-reload
refresh_pattern -i \.css$       1440    90%     129600  ignore-reload
refresh_pattern -i \.png$       1440    90%     129600  ignore-reload
refresh_pattern -i \.jpg$       1440    90%     129600  ignore-reload
refresh_pattern -i \.jpeg$      1440    90%     129600  ignore-reload
refresh_pattern -i \.gif$       1440    90%     129600  ignore-reload
refresh_pattern -i \.mp3$       1440    90%     129600  ignore-reload
refresh_pattern -i \.bmp$       1440    90%     129600  ignore-reload

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/269.html

分类: squid 标签: , ,
订阅评论
2+6= (必填)