]> git.openstreetmap.org Git - chef.git/blob - cookbooks/squid/templates/default/squid.conf.erb
Configure swap rate and timeout for rock caches
[chef.git] / cookbooks / squid / templates / default / squid.conf.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 #FIXME - configurable
4 cache_mem  <%= node[:squid][:cache_mem] %>
5
6 max_filedescriptors 65536
7
8 #used by squidclient / munin
9 http_port 3128
10 #ICP
11 icp_port 3130
12 log_icp_queries off
13
14 #FIXME - configurable
15 <% if node[:squid][:version] == "2" -%>
16 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
17 <% else -%>
18 http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
19
20 #prefer IPv4 until everything is upgraded
21 dns_v4_first on
22 <% end -%>
23
24 cache_effective_user proxy
25 cache_effective_group proxy
26
27 #FIXME - configurable
28 cache_dir <%= node[:squid][:cache_dir] %>
29 <% if node[:squid][:version] == "2" -%>
30 cache_swap_log /var/spool/squid/%s
31 <% end -%>
32
33 cache_mgr webmaster@openstreetmap.org
34
35 quick_abort_min 0 KB
36 quick_abort_max 0 KB
37
38 read_ahead_gap 64 KB
39
40 maximum_object_size 1048576 bytes
41 maximum_object_size_in_memory 64 KB
42
43 cache_replacement_policy heap LFUDA
44 memory_replacement_policy heap GDSF
45
46 server_persistent_connections on
47 persistent_request_timeout 1 minutes
48
49 negative_ttl 15 seconds
50 half_closed_clients off
51 <% if node[:squid][:version] == "2" -%>
52 pipeline_prefetch on
53 <% else -%>
54 pipeline_prefetch 1
55 <% end -%>
56
57 read_timeout 90 seconds
58 request_timeout 90 seconds
59 connect_timeout 20 seconds
60 client_lifetime 1 hours
61
62 collapsed_forwarding on
63 refresh_stale_hit 300 seconds
64
65 #Recommended minimum configuration:
66 #----------------------------------
67 acl all src all
68 acl manager proto cache_object
69 acl localhost src 127.0.0.1/32
70 acl to_localhost dst 127.0.0.0/8
71 acl SSL_ports port 443
72 acl Safe_ports port 80          # http
73 acl Safe_ports port 21          # ftp
74 acl Safe_ports port 443         # https
75 acl Safe_ports port 70          # gopher
76 acl Safe_ports port 210         # wais
77 acl Safe_ports port 1025-65535  # unregistered ports
78 acl Safe_ports port 280         # http-mgmt
79 acl Safe_ports port 488         # gss-http
80 acl Safe_ports port 591         # filemaker
81 acl Safe_ports port 777         # multiling http
82 acl CONNECT method CONNECT
83 http_access allow manager localhost
84
85 http_access allow manager
86
87 http_access deny manager
88 http_access deny !Safe_ports
89 http_access deny CONNECT !SSL_ports
90 #----------------------------------
91
92 acl purge_hosts src 127.0.0.0/8
93 acl PURGE method purge
94 http_access allow purge purge_hosts
95 http_access deny purge
96
97 forwarded_for on
98 follow_x_forwarded_for allow localhost
99
100 <% if node[:squid][:version] == "2" -%>
101 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
102 access_log <%= node[:squid][:access_log] %>
103 <% else -%>
104 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
105 access_log daemon:<%= node[:squid][:access_log] %>
106 <% end -%>
107 cache_log /var/log/squid/cache.log
108 cache_store_log none
109 buffered_logs on
110 client_db off
111 strip_query_terms off
112
113 digest_generation on
114
115 refresh_pattern .               0       50%     8640
116
117 #ZERO required for logrotate to work properly
118 logfile_rotate 0
119
120 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
121 <%= File.read(file) %>
122 <% end -%>
123
124 #MUST BE LAST ACL
125 #--------------
126 http_access deny all
127 icp_access deny all
128 #--------------
129