Modifications : etc/nginx/site.d/lhc-stats/site.conf .
[lhc/ateliers.git] / etc / nginx / site.d / lhc-stats / site.conf
1 server_name stats.heureux-cyclage.org;
2
3 client_body_buffer_size 8k;
4 client_max_body_size 10m;
5
6 if ($bad_bot) {
7 return 444;
8 }
9 #if ($bad_referer) {
10 # return 444;
11 # }
12
13 #location ~ /\. {
14 # access_log off;
15 # deny all;
16 # log_not_found off;
17 # }
18 location ~* ^.+\.(?:css|gif|jpe?g|js|png|swf)$ {
19 ## Defining the valid referers.
20 ## Disallow any usage of piwik assets if referer is non valid.
21 valid_referers none blocked
22 *.cyclocoop.org
23 *.heureux-cyclage.org
24 *.ptitvelo.net
25 *.velosenville.org
26 *.wiklou.org;
27 if ($invalid_referer) {
28 return 444;
29 }
30
31 expires max;
32 # NOTE: Static files use the OS buffer cache.
33 open_file_cache max=500 inactive=120s;
34 open_file_cache_errors off;
35 open_file_cache_min_uses 2;
36 open_file_cache_valid 45s;
37 tcp_nodelay off;
38 }
39 location = /favicon.ico {
40 ## Support for favicon. Return a 204 (No Content) if the favicon doesn't exist.
41 try_files /favicon.ico =204;
42 }
43 location / {
44 ## Try all locations and relay to index.php as a fallback.
45 try_files $uri /index.php?$query_string;
46 }
47 location = /piwik.php {
48 ## Relay all piwik.php requests to fastcgi.
49 include /etc/nginx/conf.d/fastcgi.conf;
50 add_header X-Piwik-Long-Cache $upstream_cache_status;
51 expires epoch;
52 fastcgi_cache microcache;
53 fastcgi_cache_bypass $no_cache;
54 fastcgi_cache_use_stale error timeout invalid_header updating http_500;
55 fastcgi_cache_valid 200 301 2h;
56 fastcgi_cache_valid 302 30m;
57 fastcgi_cache_valid 404 10m;
58 fastcgi_ignore_headers Cache-Control Expires;
59 fastcgi_no_cache $no_cache;
60 fastcgi_param REDIRECT_STATUS 200;
61
62 fastcgi_pass php5_fpm_lhc_stats;
63 }
64 location ~* ^.+\.php$ {
65 ## Any other attempt to access PHP files redirects to the root.
66 return 302 /;
67 }
68 location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
69 ## Redirect to the root if attempting to access a txt file.
70 return 302 /;
71 }
72 location ~* \.(?:bat|html?|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
73 ## Disallow access to several helper files.
74 return 404;
75 }
76 location = /robots.txt {
77 ## No crawling of this site for bots that obey robots.txt.
78 return 200 "User-agent: *\nDisallow: /\n";
79 }
80
81 # vim: ft=sh