]> git.openstreetmap.org Git - chef.git/blob - cookbooks/squid/templates/default/squid.conf.erb
imagery: nginx tweak for async stale background update
[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
29 # used by squidclient / munin
30 http_port 3128
31 # HTCP
32 htcp_port 4827
33 # ICP
34 icp_port 3130
35 log_icp_queries off
36
37 <% if node[:squid][:version] < 3 -%>
38 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
39 <% else -%>
40 http_port 80 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
41 http_port 8080 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
42 <% end -%>
43
44 cache_effective_user proxy
45 cache_effective_group proxy
46
47 <% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
48 cache_dir <%= cache_dir %>
49 <% end -%>
50
51 <% if node[:squid][:version] < 3 -%>
52 cache_swap_log /var/spool/squid/%s
53 <% end -%>
54
55 cache_mgr webmaster@openstreetmap.org
56
57 quick_abort_min 0 KB
58 quick_abort_max 0 KB
59
60 read_ahead_gap 64 KB
61
62 maximum_object_size 256 KB
63 maximum_object_size_in_memory 64 KB
64
65 cache_replacement_policy heap LFUDA
66 memory_replacement_policy heap GDSF
67
68 server_persistent_connections on
69 <% if node[:squid][:version] < 3 -%>
70 persistent_request_timeout 1 minutes
71 <% else -%>
72 client_idle_pconn_timeout 1 minutes
73 <% end -%>
74 <% if node[:squid][:version] > 3 -%>
75 pconn_lifetime 5 minutes
76 <% end -%>
77
78 negative_ttl 15 seconds
79 <% if node[:squid][:version] < 3 -%>
80 pipeline_prefetch on
81 <% end -%>
82
83 read_timeout 90 seconds
84 request_timeout 90 seconds
85 connect_timeout 20 seconds
86 client_lifetime 1 hours
87
88 <% if node[:squid][:version] < 3 -%>
89 refresh_stale_hit 300 seconds
90 <% end -%>
91
92 # Recommended minimum configuration:
93 # ----------------------------------
94 <% if node[:squid][:version] < 3 -%>
95 acl all src all
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
99 <% end -%>
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
113
114 http_access allow manager
115
116 http_access deny manager
117 http_access deny !Safe_ports
118 http_access deny CONNECT !SSL_ports
119 # ----------------------------------
120
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
125
126 forwarded_for on
127 follow_x_forwarded_for allow localhost
128
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] %>
132 <% else -%>
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] %>
135 <% end -%>
136 cache_log /var/log/squid/cache.log
137 cache_store_log none
138
139 client_db off
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"
147 <% end -%>
148
149 digest_generation on
150
151 refresh_pattern .               0       50%     20160
152 refresh_pattern -i tile.openstreetmap.org 60 80% 20160 reload-into-ims
153
154 # ZERO required for logrotate to work properly
155 logfile_rotate 0
156
157 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
158 <%= File.read(file) %>
159 <% end -%>
160
161 # MUST BE LAST ACL
162 # --------------
163 http_access deny all
164 htcp_access deny all
165 icp_access deny all
166 # --------------