]> git.openstreetmap.org Git - chef.git/blob - cookbooks/squid/templates/default/squid.conf.erb
tilecache: prefer ipv4 peers
[chef.git] / cookbooks / squid / templates / default / squid.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 # configure host name
4 visible_hostname <%= node.name %>
5
6 cache_mem  <%= node[:squid][:cache_mem] %>
7 <% if node[:squid][:version] > 2 -%>
8
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(',') %>
11
12 # Set short clean shutdown interval
13 shutdown_lifetime 10 seconds
14
15 error_log_languages off
16 <% end -%>
17
18 max_filedescriptors 98304
19
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
25 # Set low timeout
26 dns_timeout 15 seconds
27 <% end -%>
28 dns_v4_first on
29
30 # used by squidclient / munin
31 http_port 3128
32 # HTCP
33 htcp_port 4827
34 # ICP
35 icp_port 3130
36 log_icp_queries off
37
38 <% if node[:squid][:version] < 3 -%>
39 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
40 <% else -%>
41 # http_port 80 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
42 http_port 8080 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
43 <% end -%>
44
45 cache_effective_user proxy
46 cache_effective_group proxy
47
48 <% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
49 cache_dir <%= cache_dir %>
50 <% end -%>
51
52 <% if node[:squid][:version] < 3 -%>
53 cache_swap_log /var/spool/squid/%s
54 <% end -%>
55
56 cache_mgr webmaster@openstreetmap.org
57
58 quick_abort_min 0 KB
59 quick_abort_max 0 KB
60
61 read_ahead_gap 64 KB
62
63 maximum_object_size 256 KB
64 maximum_object_size_in_memory 64 KB
65
66 cache_replacement_policy heap LFUDA
67 memory_replacement_policy heap GDSF
68
69 server_persistent_connections on
70 <% if node[:squid][:version] < 3 -%>
71 persistent_request_timeout 1 minutes
72 <% else -%>
73 client_idle_pconn_timeout 1 minutes
74 <% end -%>
75 <% if node[:squid][:version] > 3 -%>
76 pconn_lifetime 5 minutes
77 <% end -%>
78
79 negative_ttl 15 seconds
80 <% if node[:squid][:version] < 3 -%>
81 pipeline_prefetch on
82 <% end -%>
83
84 read_timeout 90 seconds
85 request_timeout 90 seconds
86 connect_timeout 20 seconds
87 client_lifetime 1 hours
88
89 <% if node[:squid][:version] < 3 -%>
90 refresh_stale_hit 300 seconds
91 <% end -%>
92
93 # Recommended minimum configuration:
94 # ----------------------------------
95 <% if node[:squid][:version] < 3 -%>
96 acl all src all
97 acl manager proto cache_object
98 acl localhost src 127.0.0.1/32
99 acl to_localhost dst 127.0.0.0/8
100 <% end -%>
101 acl SSL_ports port 443
102 acl Safe_ports port 80          # http
103 acl Safe_ports port 21          # ftp
104 acl Safe_ports port 443         # https
105 acl Safe_ports port 70          # gopher
106 acl Safe_ports port 210         # wais
107 acl Safe_ports port 1025-65535  # unregistered ports
108 acl Safe_ports port 280         # http-mgmt
109 acl Safe_ports port 488         # gss-http
110 acl Safe_ports port 591         # filemaker
111 acl Safe_ports port 777         # multiling http
112 acl CONNECT method CONNECT
113 http_access allow manager localhost
114
115 http_access allow manager
116
117 http_access deny manager
118 http_access deny !Safe_ports
119 http_access deny CONNECT !SSL_ports
120 # ----------------------------------
121
122 acl purge_hosts src 127.0.0.0/8
123 acl PURGE method purge
124 http_access allow purge purge_hosts
125 http_access deny purge
126
127 forwarded_for on
128 follow_x_forwarded_for allow localhost
129
130 <% if node[:squid][:version] < 3 -%>
131 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
132 access_log <%= node[:squid][:access_log] %>
133 <% else -%>
134 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
135 access_log daemon:<%= node[:squid][:access_log] %>
136 <% end -%>
137 cache_log /var/log/squid/cache.log
138 cache_store_log none
139
140 client_db off
141 strip_query_terms off
142 <% if node[:squid][:version] > 2 -%>
143 # Work around bug in squid 3 that causes log_fqdn to be
144 # turned on by some of the (unused by us) default formats:
145 # http://lists.squid-cache.org/pipermail/squid-users/2016-February/thread.html#8999
146 url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
147 store_id_extras "%>a %un %>rm myip=%la myport=%lp"
148 <% end -%>
149
150 digest_generation on
151
152 refresh_pattern .               0       50%     20160
153 refresh_pattern -i tile.openstreetmap.org 60 80% 20160 reload-into-ims
154
155 # ZERO required for logrotate to work properly
156 logfile_rotate 0
157
158 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
159 <%= File.read(file) %>
160 <% end -%>
161
162 # MUST BE LAST ACL
163 # --------------
164 http_access deny all
165 htcp_access deny all
166 icp_access deny all
167 # --------------