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