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 error_log_languages off
15 max_filedescriptors 98304
17 <% if node[:squid][:version] > 3 -%>
18 # Use RFC6891 recommended max size
19 dns_packet_max 4096 bytes
20 # Use low initial retry interval (backoff start)
21 dns_retransmit_interval 2 seconds
23 dns_timeout 15 seconds
26 # used by squidclient / munin
34 <% if node[:squid][:version] < 3 -%>
35 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
37 http_port 80 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
38 http_port 8080 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
41 cache_effective_user proxy
42 cache_effective_group proxy
44 <% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
45 cache_dir <%= cache_dir %>
48 <% if node[:squid][:version] < 3 -%>
49 cache_swap_log /var/spool/squid/%s
52 cache_mgr webmaster@openstreetmap.org
59 maximum_object_size 256 KB
60 maximum_object_size_in_memory 64 KB
62 cache_replacement_policy heap LFUDA
63 memory_replacement_policy heap GDSF
65 server_persistent_connections on
66 <% if node[:squid][:version] < 3 -%>
67 persistent_request_timeout 1 minutes
69 client_idle_pconn_timeout 1 minutes
71 <% if node[:squid][:version] > 3 -%>
72 pconn_lifetime 5 minutes
75 negative_ttl 15 seconds
76 <% if node[:squid][:version] < 3 -%>
80 read_timeout 90 seconds
81 request_timeout 90 seconds
82 connect_timeout 20 seconds
83 client_lifetime 1 hours
85 <% if node[:squid][:version] < 3 -%>
86 refresh_stale_hit 300 seconds
89 # Recommended minimum configuration:
90 # ----------------------------------
91 <% if node[:squid][:version] < 3 -%>
93 acl manager proto cache_object
94 acl localhost src 127.0.0.1/32
95 acl to_localhost dst 127.0.0.0/8
97 acl SSL_ports port 443
98 acl Safe_ports port 80 # http
99 acl Safe_ports port 21 # ftp
100 acl Safe_ports port 443 # https
101 acl Safe_ports port 70 # gopher
102 acl Safe_ports port 210 # wais
103 acl Safe_ports port 1025-65535 # unregistered ports
104 acl Safe_ports port 280 # http-mgmt
105 acl Safe_ports port 488 # gss-http
106 acl Safe_ports port 591 # filemaker
107 acl Safe_ports port 777 # multiling http
108 acl CONNECT method CONNECT
109 http_access allow manager localhost
111 http_access allow manager
113 http_access deny manager
114 http_access deny !Safe_ports
115 http_access deny CONNECT !SSL_ports
116 # ----------------------------------
118 acl purge_hosts src 127.0.0.0/8
119 acl PURGE method purge
120 http_access allow purge purge_hosts
121 http_access deny purge
124 follow_x_forwarded_for allow localhost
126 <% if node[:squid][:version] < 3 -%>
127 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
128 access_log <%= node[:squid][:access_log] %>
130 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
131 access_log daemon:<%= node[:squid][:access_log] %>
133 cache_log /var/log/squid/cache.log
137 strip_query_terms off
138 <% if node[:squid][:version] > 2 -%>
139 # Work around bug in squid 3 that causes log_fqdn to be
140 # turned on by some of the (unused by us) default formats:
141 # http://lists.squid-cache.org/pipermail/squid-users/2016-February/thread.html#8999
142 url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
143 store_id_extras "%>a %un %>rm myip=%la myport=%lp"
148 refresh_pattern . 0 50% 20160
149 refresh_pattern -i tile.openstreetmap.org 60 80% 20160 reload-into-ims
151 # ZERO required for logrotate to work properly
154 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
155 <%= File.read(file) %>