Merge branch 'master' of ateliers.heureux-cyclage.org:lhc/ateliers
[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 if ($invalid_referer) {
27 return 444;
28 }
29
30 expires max;
31 # NOTE: Static files use the OS buffer cache.
32 open_file_cache max=500 inactive=120s;
33 open_file_cache_errors off;
34 open_file_cache_min_uses 2;
35 open_file_cache_valid 45s;
36 tcp_nodelay off;
37 }
38 location = /favicon.ico {
39 ## Support for favicon. Return a 204 (No Content) if the favicon doesn't exist.
40 try_files /favicon.ico =204;
41 }
42 location / {
43 ## Try all locations and relay to index.php as a fallback.
44 try_files $uri /index.php?$query_string;
45 }
46 location = /piwik.php {
47 ## Relay all piwik.php requests to fastcgi.
48 include /etc/nginx/conf.d/fastcgi.conf;
49 add_header X-Piwik-Long-Cache $upstream_cache_status;
50 expires epoch;
51 fastcgi_cache microcache;
52 fastcgi_cache_bypass $no_cache;
53 fastcgi_cache_use_stale error timeout invalid_header updating http_500;
54 fastcgi_cache_valid 200 301 2h;
55 fastcgi_cache_valid 302 30m;
56 fastcgi_cache_valid 404 10m;
57 fastcgi_ignore_headers Cache-Control Expires;
58 fastcgi_no_cache $no_cache;
59 fastcgi_param REDIRECT_STATUS 200;
60
61 fastcgi_pass php5_fpm_lhc_stats;
62 }
63 location ~* ^.+\.php$ {
64 ## Any other attempt to access PHP files redirects to the root.
65 return 302 /;
66 }
67 location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
68 ## Redirect to the root if attempting to access a txt file.
69 return 302 /;
70 }
71 location ~* \.(?:bat|html?|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
72 ## Disallow access to several helper files.
73 return 404;
74 }
75 location = /robots.txt {
76 ## No crawling of this site for bots that obey robots.txt.
77 return 200 "User-agent: *\nDisallow: /\n";
78 }
79
80 # vim: ft=sh