+server_name
+ stats.heureux-cyclage.org;
+root /home/www/data/org/heureux-cyclage/stats/www/;
+
+client_body_buffer_size 8k;
+client_max_body_size 10m;
+
+if ($bad_bot) {
+ return 444;
+ }
+#if ($bad_referer) {
+# return 444;
+# }
+
+#location ~ /\. {
+# access_log off;
+# deny all;
+# log_not_found off;
+# }
+location ~* ^.+\.(?:css|gif|jpe?g|js|png|swf)$ {
+ ## Defining the valid referers.
+ ## Disallow any usage of piwik assets if referer is non valid.
+ valid_referers none blocked
+ server_names
+ .changedechaine.org
+ .cyclocoop.org
+ .heureux-cyclage.org
+ .ptitvelo.net
+ .velosenville.org
+ .wiklou.org;
+ if ($invalid_referer) {
+ return 444;
+ }
+
+ expires max;
+ # NOTE: Static files use the OS buffer cache.
+ open_file_cache max=500 inactive=120s;
+ open_file_cache_errors off;
+ open_file_cache_min_uses 2;
+ open_file_cache_valid 45s;
+ tcp_nodelay off;
+ }
+location = /favicon.ico {
+ ## Support for favicon. Return a 204 (No Content) if the favicon doesn't exist.
+ try_files /favicon.ico =204;
+ }
+location / {
+ ## Try all locations and relay to index.php as a fallback.
+ try_files $uri /index.php?$query_string;
+ }
+location ~* ^.+\.php$ {
+ ## Relay all piwik.php requests to fastcgi.
+ include /etc/nginx/conf.d/fastcgi.conf;
+ add_header X-Piwik-Long-Cache $upstream_cache_status;
+ expires epoch;
+ fastcgi_cache microcache;
+ fastcgi_cache_bypass $lhc_stats_no_cache;
+ fastcgi_cache_use_stale error timeout invalid_header updating http_500;
+ fastcgi_cache_valid 200 301 2h;
+ fastcgi_cache_valid 302 30m;
+ fastcgi_cache_valid 404 10m;
+ fastcgi_ignore_headers Cache-Control Expires;
+ fastcgi_no_cache $lhc_stats_no_cache;
+ fastcgi_param REDIRECT_STATUS 200;
+
+ fastcgi_pass unix:CAT(sys/php5/fpm/org/heureux-cyclage/stats/socket);
+ }
+location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
+ ## Redirect to the root if attempting to access a txt file.
+ return 302 /;
+ }
+location ~* \.(?:bat|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
+ ## Disallow access to several helper files.
+ return 404;
+ }
+location = /robots.txt {
+ ## No crawling of this site for bots that obey robots.txt.
+ return 200 "User-agent: *\nDisallow: /\n";
+ }
+
+# vim: ft=sh