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