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