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