1 # DO NOT EDIT - This file is being maintained by Chef
4 visible_hostname <%= node.name %>
6 cache_mem <%= node[:squid][:cache_mem] %>
7 <% if node[:squid][:version] > 2 -%>
9 workers <%= [ node[:cpu][:total] - 2, 1 ].max.ceil %>
10 cpu_affinity_map process_numbers=<%= (1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %> cores=<%=(1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %>
12 # Set short clean shutdown interval
13 shutdown_lifetime 10 seconds
15 error_log_languages off
18 max_filedescriptors 98304
20 <% if node[:squid][:version] > 3 -%>
21 # Use RFC6891 recommended max size
22 dns_packet_max 4096 bytes
23 # Use low initial retry interval (backoff start)
24 dns_retransmit_interval 2 seconds
26 dns_timeout 15 seconds
30 # used by squidclient / munin
38 <% if node[:squid][:version] < 3 -%>
39 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
41 http_port 8080 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
44 cache_effective_user proxy
45 cache_effective_group proxy
47 <% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
48 cache_dir <%= cache_dir %>
51 <% if node[:squid][:version] < 3 -%>
52 cache_swap_log /var/spool/squid/%s
55 cache_mgr webmaster@openstreetmap.org
62 maximum_object_size 256 KB
63 maximum_object_size_in_memory 64 KB
65 cache_replacement_policy heap LFUDA
66 memory_replacement_policy heap GDSF
68 server_persistent_connections on
69 <% if node[:squid][:version] < 3 -%>
70 persistent_request_timeout 1 minutes
72 client_idle_pconn_timeout 1 minutes
74 <% if node[:squid][:version] > 3 -%>
75 pconn_lifetime 5 minutes
78 negative_ttl 15 seconds
79 <% if node[:squid][:version] < 3 -%>
83 read_timeout 90 seconds
84 request_timeout 90 seconds
85 connect_timeout 20 seconds
86 client_lifetime 1 hours
88 <% if node[:squid][:version] < 3 -%>
89 refresh_stale_hit 300 seconds
92 # Recommended minimum configuration:
93 # ----------------------------------
94 <% if node[:squid][:version] < 3 -%>
96 acl manager proto cache_object
97 acl localhost src 127.0.0.1/32
98 acl to_localhost dst 127.0.0.0/8
100 acl SSL_ports port 443
101 acl Safe_ports port 80 # http
102 acl Safe_ports port 21 # ftp
103 acl Safe_ports port 443 # https
104 acl Safe_ports port 70 # gopher
105 acl Safe_ports port 210 # wais
106 acl Safe_ports port 1025-65535 # unregistered ports
107 acl Safe_ports port 280 # http-mgmt
108 acl Safe_ports port 488 # gss-http
109 acl Safe_ports port 591 # filemaker
110 acl Safe_ports port 777 # multiling http
111 acl CONNECT method CONNECT
112 http_access allow manager localhost
114 http_access allow manager
116 http_access deny manager
117 http_access deny !Safe_ports
118 http_access deny CONNECT !SSL_ports
119 # ----------------------------------
121 acl purge_hosts src 127.0.0.0/8
122 acl PURGE method purge
123 http_access allow purge purge_hosts
124 http_access deny purge
127 follow_x_forwarded_for allow localhost
129 <% if node[:squid][:version] < 3 -%>
130 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
131 access_log <%= node[:squid][:access_log] %>
133 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
134 access_log daemon:<%= node[:squid][:access_log] %>
136 cache_log /var/log/squid/cache.log
140 strip_query_terms off
141 <% if node[:squid][:version] > 2 -%>
142 # Work around bug in squid 3 that causes log_fqdn to be
143 # turned on by some of the (unused by us) default formats:
144 # http://lists.squid-cache.org/pipermail/squid-users/2016-February/thread.html#8999
145 url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
146 store_id_extras "%>a %un %>rm myip=%la myport=%lp"
149 digest_generation off
151 refresh_pattern . 0 50% 20160
152 refresh_pattern -i tile.openstreetmap.org 60 80% 20160 reload-into-ims
154 # ZERO required for logrotate to work properly
157 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
158 <%= File.read(file) %>