]> git.openstreetmap.org Git - chef.git/blob - cookbooks/squid/templates/default/squid.conf.erb
b5827e26866db869a2733e31c2ed53d38b10747c
[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 no-vhost 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 <% if node[:squid][:version] == "2" -%>
64 refresh_stale_hit 300 seconds
65 <% end -%>
66
67 #Recommended minimum configuration:
68 #----------------------------------
69 <% if node[:squid][:version] == "2" -%>
70 acl all src all
71 acl manager proto cache_object
72 acl localhost src 127.0.0.1/32
73 acl to_localhost dst 127.0.0.0/8
74 <% end -%>
75 acl SSL_ports port 443
76 acl Safe_ports port 80          # http
77 acl Safe_ports port 21          # ftp
78 acl Safe_ports port 443         # https
79 acl Safe_ports port 70          # gopher
80 acl Safe_ports port 210         # wais
81 acl Safe_ports port 1025-65535  # unregistered ports
82 acl Safe_ports port 280         # http-mgmt
83 acl Safe_ports port 488         # gss-http
84 acl Safe_ports port 591         # filemaker
85 acl Safe_ports port 777         # multiling http
86 acl CONNECT method CONNECT
87 http_access allow manager localhost
88
89 http_access allow manager
90
91 http_access deny manager
92 http_access deny !Safe_ports
93 http_access deny CONNECT !SSL_ports
94 #----------------------------------
95
96 acl purge_hosts src 127.0.0.0/8
97 acl PURGE method purge
98 http_access allow purge purge_hosts
99 http_access deny purge
100
101 forwarded_for on
102 follow_x_forwarded_for allow localhost
103
104 <% if node[:squid][:version] == "2" -%>
105 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
106 access_log <%= node[:squid][:access_log] %>
107 <% else -%>
108 logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
109 access_log daemon:<%= node[:squid][:access_log] %>
110 <% end -%>
111 cache_log /var/log/squid/cache.log
112 cache_store_log none
113 buffered_logs on
114 client_db off
115 strip_query_terms off
116
117 digest_generation on
118
119 refresh_pattern .               0       50%     8640
120
121 #ZERO required for logrotate to work properly
122 logfile_rotate 0
123
124 <% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
125 <%= File.read(file) %>
126 <% end -%>
127
128 #MUST BE LAST ACL
129 #--------------
130 http_access deny all
131 icp_access deny all
132 #--------------
133